Whamcloud - gitweb
catch extra args without dashes
authornathan <nathan>
Thu, 8 Mar 2007 19:32:21 +0000 (19:32 +0000)
committernathan <nathan>
Thu, 8 Mar 2007 19:32:21 +0000 (19:32 +0000)
lustre/utils/mkfs_lustre.c

index dc5ba4e..9c9f381 100644 (file)
@@ -1164,15 +1164,15 @@ int parse_opts(int argc, char *const argv[], struct mkfs_opts *mop,
                                 fatal();
                                 fprintf(stderr, "Unknown option '%c'\n", opt);
                         }
                                 fatal();
                                 fprintf(stderr, "Unknown option '%c'\n", opt);
                         }
-                        usage(stderr);
-                        return 1;
+                        return EINVAL;
                 }
         }//while
                 }
         }//while
-        if (optind >= argc) {
+
+        /* Last arg is device */
+        if (optind != argc - 1) {
                 fatal();
                 fatal();
-                fprintf(stderr, "Bad arguments\n");
-                usage(stderr);
-                return 1;
+                fprintf(stderr, "Bad argument: %s\n", argv[optind]);
+                return EINVAL;
         }
 
         return 0;
         }
 
         return 0;