Commit 329d8aa6 authored by Pavel Emelyanov's avatar Pavel Emelyanov Committed by Cyrill Gorcunov

The pid == 0 is enough.

Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
Signed-off-by: 's avatarCyrill Gorcunov <gorcunov@openvz.org>
parent d4fd9104
...@@ -250,12 +250,11 @@ int get_image_path(char *path, int size, const char *fmt, int pid) ...@@ -250,12 +250,11 @@ int get_image_path(char *path, int size, const char *fmt, int pid)
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
pid_t pid; pid_t pid = 0;
int ret = -1; int ret = -1;
int opt, idx; int opt, idx;
int action = -1; int action = -1;
int log_inited = 0; int log_inited = 0;
bool has_pid = false;
static const char short_opts[] = "drsf:p:t:hcD:o:"; static const char short_opts[] = "drsf:p:t:hcD:o:";
static const struct option long_opts[] = { static const struct option long_opts[] = {
...@@ -281,13 +280,10 @@ int main(int argc, char *argv[]) ...@@ -281,13 +280,10 @@ int main(int argc, char *argv[])
case 'p': case 'p':
pid = atoi(optarg); pid = atoi(optarg);
opts.leader_only = true; opts.leader_only = true;
has_pid = true;
break; break;
case 't': case 't':
pid = atoi(optarg); pid = atoi(optarg);
opts.leader_only = false; opts.leader_only = false;
has_pid = true;
break;
break; break;
case 'd': case 'd':
action = opt; action = opt;
...@@ -333,10 +329,8 @@ int main(int argc, char *argv[]) ...@@ -333,10 +329,8 @@ int main(int argc, char *argv[])
return -1; return -1;
} }
if (!has_pid) { if (!pid && (action != 's' || !opts.show_dump_file))
if (action != 's' || !opts.show_dump_file) goto opt_pid_missing;
goto opt_pid_missing;
}
switch (action) { switch (action) {
case 'd': case 'd':
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment