diff mbox

Btrfs-progs print more informative error when we fail to open a device

Message ID 1359993477-18281-2-git-send-email-gene@czarc.net (mailing list archive)
State Accepted, archived
Headers show

Commit Message

Gene Czarcinski Feb. 4, 2013, 3:57 p.m. UTC
From: Eric Sandeen <sandeen@redhat.com>

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 | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

David Sterba Feb. 6, 2013, 10:09 p.m. UTC | #1
On Mon, Feb 04, 2013 at 10:57:57AM -0500, Gene Czarcinski wrote:
> From: Eric Sandeen <sandeen@redhat.com>
> 
> print more informative error when we fail to open a device
> 
> If open() fails, we should let the user know why it failed.

Thanks, added to next integration queue.
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/utils.c b/utils.c
index d92f317..b560a49 100644
--- a/utils.c
+++ b/utils.c
@@ -1212,7 +1212,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,