From: Kamalesh Babulal Date: Thu, 29 Sep 2022 10:20:10 +0000 (+0530) Subject: tools/cgexec: use exit code 129 on invalid usage X-Git-Tag: v3.1.0~300 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=13f8ddd305a24a17934f467244f0dc3887f45a48;p=thirdparty%2Flibcgroup.git tools/cgexec: use exit code 129 on invalid usage The exit code 1 refers to general error and using -1 wraps to 255, both codes do not signify bad arguments. Let's use exit code 129 (EXIT_BADARGS) for hinting to the users about invalid usage. Signed-off-by: Kamalesh Babulal Signed-off-by: Tom Hromatka --- diff --git a/src/tools/cgexec.c b/src/tools/cgexec.c index eb3a91fb..efd499b0 100644 --- a/src/tools/cgexec.c +++ b/src/tools/cgexec.c @@ -70,7 +70,7 @@ int main(int argc, char *argv[]) ret = parse_cgroup_spec(cgroup_list, optarg, CG_HIER_MAX); if (ret) { err("cgroup controller and path parsing failed\n"); - return -1; + exit(EXIT_BADARGS); } cg_specified = 1; break; @@ -82,14 +82,14 @@ int main(int argc, char *argv[]) exit(0); default: usage(1, argv[0]); - exit(1); + exit(EXIT_BADARGS); } } /* Executable name */ if (!argv[optind]) { usage(1, argv[0]); - exit(1); + exit(EXIT_BADARGS); } /* Initialize libcg */