From: Kamalesh Babulal Date: Fri, 30 Sep 2022 14:38:18 +0000 (-0600) Subject: tools/cgclassify: use exit code 129 on invalid usage X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2f4e0feba1c418ae4ec221815b16b1f7f6dbfa97;p=thirdparty%2Flibcgroup.git tools/cgclassify: 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 (cherry picked from commit f9c9d39c12c21fd6168a212b36625e9b24384b68) --- diff --git a/src/tools/cgclassify.c b/src/tools/cgclassify.c index d3d058fe..147b9dbf 100644 --- a/src/tools/cgclassify.c +++ b/src/tools/cgclassify.c @@ -122,7 +122,7 @@ int main(int argc, char *argv[]) if (argc < 2) { usage(1, argv[0]); - exit(2); + exit(EXIT_BADARGS); } memset(cgroup_list, 0, sizeof(cgroup_list)); @@ -136,7 +136,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; @@ -148,7 +148,7 @@ int main(int argc, char *argv[]) break; default: usage(1, argv[0]); - exit(2); + exit(EXIT_BADARGS); break; } }