]> git.ipfire.org Git - thirdparty/libcgroup.git/commitdiff
tools/cgdelete: add check for the cmdline arguments
authorKamalesh Babulal <kamalesh.babulal@oracle.com>
Thu, 29 Sep 2022 10:19:46 +0000 (15:49 +0530)
committerTom Hromatka <tom.hromatka@oracle.com>
Fri, 30 Sep 2022 14:34:55 +0000 (08:34 -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 7eaab2cb5a744607c3b9b216f6c05ef5e762eaaf..28ddca35cfbc226abcb03febe5602d6253ab0c78 100644 (file)
@@ -123,6 +123,11 @@ int main(int argc, char *argv[])
        int i, j, c;
        int skip;
 
+       if (argc < 2) {
+               usage(1, argv[0]);
+               exit (1);
+       }
+
        /* initialize libcg */
        ret = cgroup_init();
        if (ret) {