Do not silently ignore additional arguments:

        $ vmctl create
        usage:  vmctl [-v] create [-b base | -i disk] [-s size] disk
        $ vmctl create -s 1G 1.img 2.img
        vmctl: raw imagefile created
        $ ls *.img
        1.img

        $ ./obj/vmctl create -s 1G 1.qcow2 2.qcow2
        usage:  vmctl [-v] create [-b base | -i disk] [-s size] disk
        $ ./obj/vmctl create -s 1G 1.qcow2
        vmctl: qcow2 imagefile created
        $ ls *.qcow2
        1.qcow2

All other commands seem to properly check argc.

OK?

Index: main.c
===================================================================
RCS file: /cvs/src/usr.sbin/vmctl/main.c,v
retrieving revision 1.71
diff -u -p -r1.71 main.c
--- main.c      13 May 2022 00:17:20 -0000      1.71
+++ main.c      30 Jul 2022 06:32:05 -0000
@@ -587,7 +587,7 @@ ctl_create(struct parse_result *res, int
        argc -= optind;
        argv += optind;
 
-       if (argc < 1)
+       if (argc != 1)
                ctl_usage(res->ctl);
 
        type = parse_disktype(argv[0], &disk);

Reply via email to