• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1From 77ac16dfba42e0d152b1e99359e01a933f8cc6f9 Mon Sep 17 00:00:00 2001
2From: Zhiqiang Liu <liuzhiqiang26@huawei.com>
3Date: Mon, 5 Sep 2022 23:40:01 +0800
4Subject: [PATCH] tune2fs: tune2fs_main() should return rc when some error,
5 occurs
6
7If some error occurs, tune2fs_main() will go to closefs tag for
8releasing resource, and it should return correct value (rc) instead
9of 0 when ext2fs_close_free(&fs) successes.
10
11Signed-off-by: Zhiqiang Liu <liuzhiqiang26@huawei.com>
12Reviewed-by: Artem Blagodarenko <artem.blagodarenko@gmail.com>
13Signed-off-by: Theodore Ts'o <tytso@mit.edu>
14---
15 misc/tune2fs.c | 3 ++-
16 1 file changed, 2 insertions(+), 1 deletion(-)
17
18diff --git a/misc/tune2fs.c b/misc/tune2fs.c
19index 98e38983..bed3d95b 100644
20--- a/misc/tune2fs.c
21+++ b/misc/tune2fs.c
22@@ -3243,6 +3243,7 @@ _("Warning: The journal is dirty. You may wish to replay the journal like:\n\n"
23 			fputs(_("Error in using clear_mmp. "
24 				"It must be used with -f\n"),
25 			      stderr);
26+			rc = 1;
27 			goto closefs;
28 		}
29 	}
30@@ -3447,5 +3448,5 @@ closefs:
31
32 	if (feature_64bit)
33 		convert_64bit(fs, feature_64bit);
34-	return (ext2fs_close_free(&fs) ? 1 : 0);
35+	return (ext2fs_close_free(&fs) ? 1 : rc);
36 }
37--
382.33.0
39
40