I blatantly missed the argc/argv adjustments after getopt(3), resulting
in valid commands like `vmctl create a -s 1G' to fail.

Noticed by ajacoutot the hard way.

OK?

Index: usr.sbin/vmctl/main.c
===================================================================
RCS file: /cvs/src/usr.sbin/vmctl/main.c,v
retrieving revision 1.53
diff -u -p -r1.53 main.c
--- usr.sbin/vmctl/main.c       1 Mar 2019 10:34:14 -0000       1.53
+++ usr.sbin/vmctl/main.c       1 Mar 2019 12:25:23 -0000
@@ -598,6 +598,8 @@ ctl_create(struct parse_result *res, int
                        /* NOTREACHED */
                }
        }
+       argc -= optind;
+       argv += optind;
 
        if (argc > 0)
                ctl_usage(res->ctl);
@@ -915,6 +917,8 @@ ctl_start(struct parse_result *res, int 
                        /* NOTREACHED */
                }
        }
+       argc -= optind;
+       argv += optind;
 
        if (argc > 0)
                ctl_usage(res->ctl);
@@ -959,6 +963,8 @@ ctl_stop(struct parse_result *res, int a
                        /* NOTREACHED */
                }
        }
+       argc -= optind;
+       argv += optind;
 
        if (argc > 0)
                ctl_usage(res->ctl);

Reply via email to