vfstest: don't ignore unknown options
[vlendec/samba-autobuild/.git] / 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);