From: Kamalesh Babulal Date: Wed, 28 Sep 2022 15:26:47 +0000 (-0600) Subject: tools/cgdelete: add check for the cmdline arguments X-Git-Tag: v2.0.3~10 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0fc4d286cdc12959d2c7ed3f451ce2756e7fd179;p=thirdparty%2Flibcgroup.git tools/cgdelete: add check for the cmdline arguments Like other tools, throw an error and exit, if the minimum required arguments are not passed. Signed-off-by: Kamalesh Babulal Signed-off-by: Tom Hromatka --- diff --git a/src/tools/cgdelete.c b/src/tools/cgdelete.c index 13a86c38..a436d875 100644 --- a/src/tools/cgdelete.c +++ b/src/tools/cgdelete.c @@ -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) {