[PATCH] btrfs-progs: check: Sanitize the return value for qgroup error

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



[BUG]
btrfs check can return strange return value for shell:
 [Inferior 1 (process 48641) exited with code 0213]
					      ^^^^

[CAUSE]
It's caused by the incorrect handling of qgroup error.

qgroup_report_ret can be -117 (-EUCLEAN), using that value with exit()
can cause overflow, causing return value not properly recognized.

[FIX]
Fix it by sanitize the return value to 0 or 1.

Signed-off-by: Qu Wenruo <wqu@xxxxxxxx>
---
 check/main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/check/main.c b/check/main.c
index 37c5b35a36bd..8e29337c5c23 100644
--- a/check/main.c
+++ b/check/main.c
@@ -10458,7 +10458,7 @@ static int cmd_check(const struct cmd_struct *cmd, int argc, char **argv)
 			goto out;
 		}
 		if (qgroup_report_ret && (!qgroups_repaired || ret))
-			err |= qgroup_report_ret;
+			err |= !!qgroup_report_ret;
 		ret = 0;
 	} else {
 		fprintf(stderr,
-- 
2.26.0




[Index of Archives]     [Linux Filesystem Development]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux