btrfs-progs: don't have to report ENOMEDIUM error during open
authorAnand Jain <anand.jain@oracle.com>
Thu, 25 Jul 2013 17:35:30 +0000 (01:35 +0800)
committerDavid Sterba <dsterba@suse.cz>
Tue, 3 Sep 2013 17:40:44 +0000 (19:40 +0200)
when we scan /proc/partitions the cdrom is scanned
as well, and we don't have to report ENOMEDIUM errors
against it.

Signed-off-by: Anand Jain <anand.jain@oracle.com>
Signed-off-by: David Sterba <dsterba@suse.cz>
Signed-off-by: Chris Mason <chris.mason@fusionio.com>
utils.c

diff --git a/utils.c b/utils.c
index 46f502d..6b4c4a7 100644 (file)
--- a/utils.c
+++ b/utils.c
@@ -1438,8 +1438,9 @@ scan_again:
 
                fd = open(fullpath, O_RDONLY);
                if (fd < 0) {
-                       fprintf(stderr, "failed to open %s: %s\n",
-                               fullpath, strerror(errno));
+                       if (errno != ENOMEDIUM)
+                               fprintf(stderr, "failed to open %s: %s\n",
+                                       fullpath, strerror(errno));
                        continue;
                }
                ret = btrfs_scan_one_device(fd, fullpath, &tmp_devices,