]> git.ipfire.org Git - thirdparty/libcgroup.git/commitdiff
tools/cgdelete: add check for the cmdline arguments
authorKamalesh Babulal <kamalesh.babulal@oracle.com>
Wed, 28 Sep 2022 15:26:47 +0000 (09:26 -0600)
committerTom Hromatka <tom.hromatka@oracle.com>
Wed, 28 Sep 2022 15:26:51 +0000 (09:26 -0600)
Like other tools, throw an error and exit, if the minimum required
arguments are not passed.

Signed-off-by: Kamalesh Babulal <kamalesh.babulal@oracle.com>
Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
src/tools/cgdelete.c

index 13a86c38ef54845b02b7a3169ce3483539810586..a436d8758429f5cf38ffd17919f6afda61a95065 100644 (file)
@@ -139,6 +139,11 @@ int main(int argc, char *argv[])
        struct cgroup *cgroup;
        struct cgroup_controller *cgc;
 
+       if (argc < 2) {
+               usage(1,  argv[0]);
+               exit (1);
+       }
+
        /* initialize libcg */
        ret = cgroup_init();
        if (ret) {