mirror of
https://github.com/checkpoint-restore/criu
synced 2025-08-29 05:18:00 +00:00
criu: don't return negative values from main() 2/2
We should return 1 not -1, because -1 becomes 255. This is second part, patching return from functions. Using 'ret != 0' condition seems like the best and easiest thing to do, so we expect a function to return 0 in normal case and any non-zero value in case of error. Signed-off-by: Kir Kolyshkin <kir@openvz.org> Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
This commit is contained in:
parent
f59326aba6
commit
09b7b57c83
14
crtools.c
14
crtools.c
@ -313,7 +313,7 @@ int main(int argc, char *argv[])
|
||||
if (!strcmp(argv[optind], "dump")) {
|
||||
if (!tree_id)
|
||||
goto opt_pid_missing;
|
||||
return cr_dump_tasks(tree_id);
|
||||
return cr_dump_tasks(tree_id) != 0;
|
||||
}
|
||||
|
||||
if (!strcmp(argv[optind], "pre-dump")) {
|
||||
@ -330,31 +330,31 @@ int main(int argc, char *argv[])
|
||||
opts.final_state = TASK_ALIVE;
|
||||
}
|
||||
|
||||
return cr_pre_dump_tasks(tree_id);
|
||||
return cr_pre_dump_tasks(tree_id) != 0;
|
||||
}
|
||||
|
||||
if (!strcmp(argv[optind], "restore")) {
|
||||
if (tree_id)
|
||||
pr_warn("Using -t with criu restore is obsoleted\n");
|
||||
return cr_restore_tasks();
|
||||
return cr_restore_tasks() != 0;
|
||||
}
|
||||
|
||||
if (!strcmp(argv[optind], "show"))
|
||||
return cr_show(pid);
|
||||
return cr_show(pid) != 0;
|
||||
|
||||
if (!strcmp(argv[optind], "check"))
|
||||
return cr_check();
|
||||
return cr_check() != 0;
|
||||
|
||||
if (!strcmp(argv[optind], "exec")) {
|
||||
if (!pid)
|
||||
pid = tree_id; /* old usage */
|
||||
if (!pid)
|
||||
goto opt_pid_missing;
|
||||
return cr_exec(pid, argv + optind + 1);
|
||||
return cr_exec(pid, argv + optind + 1) != 0;
|
||||
}
|
||||
|
||||
if (!strcmp(argv[optind], "page-server"))
|
||||
return cr_page_server(opts.restore_detach);
|
||||
return cr_page_server(opts.restore_detach) != 0;
|
||||
|
||||
if (!strcmp(argv[optind], "service"))
|
||||
return cr_service(opts.restore_detach);
|
||||
|
Loading…
x
Reference in New Issue
Block a user