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);