Whamcloud - gitweb
tune2fs: tune2fs_main() should return rc when some error, occurs
authorZhiqiang Liu <liuzhiqiang26@huawei.com>
Mon, 5 Sep 2022 15:40:01 +0000 (23:40 +0800)
committerTheodore Ts'o <tytso@mit.edu>
Mon, 12 Sep 2022 11:52:53 +0000 (07:52 -0400)
If some error occurs, tune2fs_main() will go to closefs tag for
releasing resource, and it should return correct value (rc) instead
of 0 when ext2fs_close_free(&fs) successes.

Signed-off-by: Zhiqiang Liu <liuzhiqiang26@huawei.com>
Reviewed-by: Artem Blagodarenko <artem.blagodarenko@gmail.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
misc/tune2fs.c

index 98e3898..bed3d95 100644 (file)
@@ -3243,6 +3243,7 @@ _("Warning: The journal is dirty. You may wish to replay the journal like:\n\n"
                        fputs(_("Error in using clear_mmp. "
                                "It must be used with -f\n"),
                              stderr);
+                       rc = 1;
                        goto closefs;
                }
        }
@@ -3447,5 +3448,5 @@ closefs:
 
        if (feature_64bit)
                convert_64bit(fs, feature_64bit);
-       return (ext2fs_close_free(&fs) ? 1 : 0);
+       return (ext2fs_close_free(&fs) ? 1 : rc);
 }