Commit 344ccb36 authored by Cyrill Gorcunov's avatar Cyrill Gorcunov

crtools: Make sure pid is specified in command line

Signed-off-by: 's avatarCyrill Gorcunov <gorcunov@openvz.org>
parent 7b1ea147
...@@ -248,6 +248,7 @@ int main(int argc, char *argv[]) ...@@ -248,6 +248,7 @@ int main(int argc, char *argv[])
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[] = {
...@@ -273,10 +274,13 @@ int main(int argc, char *argv[]) ...@@ -273,10 +274,13 @@ 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;
...@@ -323,6 +327,11 @@ int main(int argc, char *argv[]) ...@@ -323,6 +327,11 @@ int main(int argc, char *argv[])
return -1; return -1;
} }
if (!has_pid) {
pr_err("No pid specified, -t or -p option missed?\n");
return -1;
}
switch (action) { switch (action) {
case 'd': case 'd':
ret = cr_dump_tasks(pid, &opts); ret = cr_dump_tasks(pid, &opts);
......
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