]> git.ipfire.org Git - thirdparty/libcgroup.git/commitdiff
tools/cgclassify: use exit code 129 on invalid usage
authorKamalesh Babulal <kamalesh.babulal@oracle.com>
Thu, 29 Sep 2022 10:20:20 +0000 (15:50 +0530)
committerTom Hromatka <tom.hromatka@oracle.com>
Fri, 30 Sep 2022 14:34:55 +0000 (08:34 -0600)
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 <kamalesh.babulal@oracle.com>
Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
src/tools/cgclassify.c

index d3d058fe5b45244b7d6671f633b1041588223eb2..147b9dbfa2338a7f8d931c26317ad6a101d93c4f 100644 (file)
@@ -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;
                }
        }