From 002d5e14304aae3c4df45b36f99cdeec51a87b4c Mon Sep 17 00:00:00 2001 From: Gui Hecheng Date: Thu, 20 Feb 2014 10:49:05 +0800 Subject: [PATCH] btrfs-progs: fix wrong error msg for exec btrfsck as non-root 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 Signed-off-by: David Sterba Signed-off-by: Chris Mason --- utils.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utils.c b/utils.c index 9a921f0..398678f 100644 --- a/utils.c +++ b/utils.c @@ -1111,7 +1111,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) { -- 2.7.4