From 09b7b57c83370296516af0d2f3ab597300d576ef Mon Sep 17 00:00:00 2001 From: Kir Kolyshkin Date: Thu, 12 Dec 2013 10:02:28 -0800 Subject: [PATCH] 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 Signed-off-by: Pavel Emelyanov --- crtools.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/crtools.c b/crtools.c index 01f529d31..d8e434d75 100644 --- a/crtools.c +++ b/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);