btrfs-progs: check: sanitize the return value for qgroup error

[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.

Reviewed-by: Nikolay Borisov <nborisov@suse.com>
Signed-off-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
Qu Wenruo 2020-03-30 15:01:59 +08:00 committed by David Sterba
parent 766c2fbd1f
commit 6384f9df92

View file

@ -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,