fsck.f2fs: allow -p without value
authorJaegeuk Kim <jaegeuk@kernel.org>
Wed, 31 Jan 2018 01:24:57 +0000 (17:24 -0800)
committerJaegeuk Kim <jaegeuk@kernel.org>
Mon, 7 May 2018 21:49:37 +0000 (14:49 -0700)
This patch allows -p without value.

Suggested-by: Pavol Cupka <pavol.cupka@gmail.com>
Reviewed-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
fsck/main.c

index f35d01d..804f71a 100644 (file)
@@ -184,13 +184,13 @@ void f2fs_parse_options(int argc, char *argv[])
                                 *  0: default level, the same as -a
                                 *  1: check meta
                                 */
-                               if (optarg[0] == '-') {
+                               if (optarg[0] == '-' || !is_digits(optarg) ||
+                                                       optind == argc) {
+                                       MSG(0, "Info: Use default preen mode\n");
                                        c.preen_mode = PREEN_MODE_0;
+                                       c.auto_fix = 1;
                                        optind--;
                                        break;
-                               } else if (!is_digits(optarg)) {
-                                       err = EWRONG_OPT;
-                                       break;
                                }
                                c.preen_mode = atoi(optarg);
                                if (c.preen_mode < 0)