From: Qu Wenruo <wqu@suse.com>
To: linux-btrfs@vger.kernel.org
Subject: [PATCH] btrfs-progs: check: Sanitize the return value for qgroup error
Date: Mon, 30 Mar 2020 15:01:59 +0800 [thread overview]
Message-ID: <20200330070159.50077-1-wqu@suse.com> (raw)
[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@suse.com>
---
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
next reply other threads:[~2020-03-30 7:02 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-03-30 7:01 Qu Wenruo [this message]
2020-03-30 9:15 ` [PATCH] btrfs-progs: check: Sanitize the return value for qgroup error Nikolay Borisov
2020-04-01 17:57 ` David Sterba
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200330070159.50077-1-wqu@suse.com \
--to=wqu@suse.com \
--cc=linux-btrfs@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox