Commit 7e3b9079 authored by Kir Kolyshkin's avatar Kir Kolyshkin Committed by Pavel Emelyanov

criu: don't show long usage in case of error

* Don't show long usage in case of usage error, otherwise an actual
  error message will be lost in long output.

* Print error if command is not specified.

* Return 0 if criu --help is used.
Signed-off-by: 's avatarKir Kolyshkin <kir@openvz.org>
Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent 5d12a116
......@@ -79,6 +79,7 @@ int main(int argc, char *argv[])
{
pid_t pid = 0, tree_id = 0;
int ret = -1;
bool usage_error = true;
int opt, idx;
int log_level = 0;
char *imgs_dir = ".";
......@@ -293,6 +294,8 @@ int main(int argc, char *argv[])
pr_msg("GitID: %s\n", CRIU_GITID);
return 0;
case 'h':
usage_error = false;
goto usage;
default:
goto usage;
}
......@@ -301,8 +304,10 @@ int main(int argc, char *argv[])
if (work_dir == NULL)
work_dir = imgs_dir;
if (optind >= argc)
if (optind >= argc) {
pr_msg("Error: command is required\n");
goto usage;
}
/* We must not open imgs dir, if service is called */
if (strcmp(argv[optind], "service")) {
......@@ -401,7 +406,7 @@ usage:
" dedup remove duplicates in memory dump\n"
);
if (argc < 2) {
if (usage_error) {
pr_msg("\nTry -h|--help for more info\n");
return 1;
}
......@@ -465,7 +470,7 @@ usage:
" --ms don't check not yet merged kernel features\n"
);
return 1;
return 0;
opt_pid_missing:
pr_msg("Error: pid not specified\n");
......
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