vfstest: don't ignore unknown options
authorRalph Boehme <slow@samba.org>
Fri, 10 Sep 2021 05:04:21 +0000 (07:04 +0200)
committerRalph Boehme <slow@samba.org>
Fri, 10 Sep 2021 15:10:30 +0000 (15:10 +0000)
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14828

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
source3/torture/vfstest.c

index 5c0ef2d073d4577d8a063ca0e23601d4a7188b21..3f01c4312893451ac842c2d62ebd910968f464d6 100644 (file)
@@ -469,6 +469,7 @@ int main(int argc, const char *argv[])
        struct cmd_set  **cmd_set;
        struct conn_struct_tos *c = NULL;
        struct vfs_state *vfs;
+       int opt;
        int i;
        char *filename = NULL;
        char *cwd = NULL;
@@ -531,8 +532,15 @@ int main(int argc, const char *argv[])
                exit(1);
        }
 
-       while(poptGetNextOpt(pc) != -1);
-
+       while ((opt = poptGetNextOpt(pc)) != -1) {
+               switch (opt) {
+               case POPT_ERROR_BADOPT:
+                       fprintf(stderr, "\nInvalid option %s: %s\n\n",
+                               poptBadOption(pc, 0), poptStrerror(opt));
+                       poptPrintUsage(pc, stderr, 0);
+                       exit(1);
+               }
+       }
 
        poptFreeContext(pc);