This patch allows fsck run -p without argument. So we could use -p as -p, -p0, and -p1. '-p' and '-p0' have the same meaning as '-a'. '-p1' checks more meta data than '-a'.
Reported-by: KARBOWSKI Piotr <piotr.karbow...@gmail.com> Signed-off-by: Sheng Yong <shengyo...@huawei.com> --- fsck/main.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/fsck/main.c b/fsck/main.c index 64537cc..78d10fa 100644 --- a/fsck/main.c +++ b/fsck/main.c @@ -83,7 +83,7 @@ void f2fs_parse_options(int argc, char *argv[]) char *prog = basename(argv[0]); if (!strcmp("fsck.f2fs", prog)) { - const char *option_string = "ad:fp:t"; + const char *option_string = "ad:fp::t"; c.func = FSCK; while ((option = getopt(argc, argv, option_string)) != EOF) { @@ -97,11 +97,15 @@ void f2fs_parse_options(int argc, char *argv[]) * 0: default level, the same as -a * 1: check meta */ - c.preen_mode = atoi(optarg); - if (c.preen_mode < 0) + if (optarg == NULL) { c.preen_mode = PREEN_MODE_0; - else if (c.preen_mode >= PREEN_MODE_MAX) - c.preen_mode = PREEN_MODE_MAX - 1; + } else { + c.preen_mode = atoi(optarg); + if (c.preen_mode < 0) + c.preen_mode = PREEN_MODE_0; + else if (c.preen_mode >= PREEN_MODE_MAX) + c.preen_mode = PREEN_MODE_MAX - 1; + } if (c.preen_mode == PREEN_MODE_0) c.auto_fix = 1; MSG(0, "Info: Fix the reported corruption in " -- 2.10.1 ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, SlashDot.org! http://sdm.link/slashdot _______________________________________________ Linux-f2fs-devel mailing list Linux-f2fs-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel