Btrfs-progs print more informative error when we fail to open a device
authorEric Sandeen <sandeen@redhat.com>
Mon, 4 Feb 2013 15:57:57 +0000 (10:57 -0500)
committerDavid Sterba <dsterba@suse.cz>
Wed, 6 Feb 2013 22:09:02 +0000 (23:09 +0100)
print more informative error when we fail to open a device

If open() fails, we should let the user know why it failed.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Gene Czarcinski <gene@czarc.net>
utils.c

diff --git a/utils.c b/utils.c
index f9ee812..01780ff 100644 (file)
--- a/utils.c
+++ b/utils.c
@@ -1229,7 +1229,8 @@ scan_again:
 
                fd = open(fullpath, O_RDONLY);
                if (fd < 0) {
-                       fprintf(stderr, "failed to read %s\n", fullpath);
+                       fprintf(stderr, "failed to open %s: %s\n",
+                               fullpath, strerror(errno));
                        continue;
                }
                ret = btrfs_scan_one_device(fd, fullpath, &tmp_devices,