aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZhiqiang Liu <liuzhiqiang26@huawei.com>2022-09-05 23:40:01 +0800
committerTheodore Ts'o <tytso@mit.edu>2022-09-12 07:52:53 -0400
commit77ac16dfba42e0d152b1e99359e01a933f8cc6f9 (patch)
tree5fc7a88f2c2d1c268935f11779ea4277a716e444
parent66ecb6abe5d2c74191bb4bc24f3da036e5fa1213 (diff)
downloade2fsprogs-77ac16dfba42e0d152b1e99359e01a933f8cc6f9.tar.gz
tune2fs: tune2fs_main() should return rc when some error, occurs
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>
-rw-r--r--misc/tune2fs.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/misc/tune2fs.c b/misc/tune2fs.c
index 98e38983b..bed3d95b6 100644
--- a/misc/tune2fs.c
+++ b/misc/tune2fs.c
@@ -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);
}