From: Gui Hecheng <guihc.fnst@cn.fujitsu.com>
To: linux-btrfs@vger.kernel.org
Cc: Gui Hecheng <guihc.fnst@cn.fujitsu.com>
Subject: [PATCH 3/4] btrfs-progs: fix wrong error msg for exec btrfsck as non-root
Date: Thu, 20 Feb 2014 10:49:05 +0800 [thread overview]
Message-ID: <1392864546-545-3-git-send-email-guihc.fnst@cn.fujitsu.com> (raw)
In-Reply-To: <1392864546-545-1-git-send-email-guihc.fnst@cn.fujitsu.com>
When exec btrfsck as non-root user on a disk, btrfsck will always
warn that "No such file or directory", despite that a directory
(e.g. /dev/vboxusb)actually exists. We just have no permission.
In this case, return the -errno set by the opendir call in
btrfs_scan_one_dir rather than blindly return -ENOENT.
Signed-off-by: Gui Hecheng <guihc.fnst@cn.fujitsu.com>
---
utils.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/utils.c b/utils.c
index 1878abc..12ed2f4 100644
--- a/utils.c
+++ b/utils.c
@@ -1114,7 +1114,7 @@ again:
dirp = opendir(dirname);
if (!dirp) {
fprintf(stderr, "Unable to open %s for scanning\n", dirname);
- ret = -ENOENT;
+ ret = -errno;
goto fail;
}
while(1) {
--
1.8.1.4
next prev parent reply other threads:[~2014-02-20 2:52 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-02-20 2:49 [PATCH 1/4] btrfs-progs: judge the return value of check_mounted more accurately Gui Hecheng
2014-02-20 2:49 ` [PATCH 2/4] btrfs-progs: fix segment fault when exec btrfs-debug-tree as non-root Gui Hecheng
2014-02-20 8:48 ` Mike Fleetwood
2014-02-20 9:59 ` Gui Hecheng
2014-02-20 2:49 ` Gui Hecheng [this message]
2014-02-20 2:49 ` [PATCH 4/4] btrfs-progs: clean the unnecessary error msg of btrfs-file-show Gui Hecheng
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=1392864546-545-3-git-send-email-guihc.fnst@cn.fujitsu.com \
--to=guihc.fnst@cn.fujitsu.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;
as well as URLs for NNTP newsgroup(s).