]> git.ipfire.org Git - thirdparty/libcgroup.git/commitdiff
tools/cgdelete: add check for the cmdline arguments
authorKamalesh Babulal <kamalesh.babulal@oracle.com>
Fri, 30 Sep 2022 14:36:59 +0000 (08:36 -0600)
committerTom Hromatka <tom.hromatka@oracle.com>
Fri, 30 Sep 2022 14:37:02 +0000 (08:37 -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>
(cherry picked from commit de86f6862d439f4c680f07f02a1496661bb1f7a7)

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) {