]> git.ipfire.org Git - thirdparty/util-linux.git/blobdiff - misc-utils/blkid.c
libblkid: check status for the current CDROM slot
[thirdparty/util-linux.git] / misc-utils / blkid.c
index f2583d2b883f4270204dec4fc8943e91676fd572..88a90578b030b1658860ed5fedadeefd3a3c11da 100644 (file)
@@ -499,13 +499,17 @@ static int lowprobe_device(blkid_probe pr, const char *devname,
        int rc = 0;
        static int first = 1;
 
-       fd = open(devname, O_RDONLY|O_CLOEXEC);
+       fd = open(devname, O_RDONLY|O_CLOEXEC|O_NONBLOCK);
        if (fd < 0) {
                warn(_("error: %s"), devname);
                return BLKID_EXIT_NOTFOUND;
        }
-       if (blkid_probe_set_device(pr, fd, ctl->offset, ctl->size))
+       errno = 0;
+       if (blkid_probe_set_device(pr, fd, ctl->offset, ctl->size)) {
+               if (errno)
+                       warn(_("error: %s"), devname);
                goto done;
+       }
 
        if (ctl->lowprobe_topology)
                rc = lowprobe_topology(pr);