[PATCH] f2fs-toos: fsck.f2fs Fix bad return value

From: Robin Hsu
Date: Mon Oct 26 2020 - 05:40:00 EST


'ret' should not have been used here: otherwise, it would be wrongly used
as the error code and then be returned from main().

Signed-off-by: Robin Hsu <robinhsu@xxxxxxxxxx>
Reviewed-by: Chao Yu <yuchao0@xxxxxxxxxx>
Signed-off-by: Jaegeuk Kim <jaegeuk@xxxxxxxxxx>
---
fsck/fsck.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/fsck/fsck.c b/fsck/fsck.c
index 647523397f3e..e52672032d2c 100644
--- a/fsck/fsck.c
+++ b/fsck/fsck.c
@@ -3146,10 +3146,11 @@ int fsck_verify(struct f2fs_sb_info *sbi)
#ifndef WITH_ANDROID
if (nr_unref_nid && !c.ro) {
char ans[255] = {0};
+ int res;

printf("\nDo you want to restore lost files into ./lost_found/? [Y/N] ");
- ret = scanf("%s", ans);
- ASSERT(ret >= 0);
+ res = scanf("%s", ans);
+ ASSERT(res >= 0);
if (!strcasecmp(ans, "y")) {
for (i = 0; i < fsck->nr_nat_entries; i++) {
if (f2fs_test_bit(i, fsck->nat_area_bitmap))
--
2.29.1.341.ge80a0c044ae-goog