]> err.no Git - util-linux/commitdiff
Only check for ENOMEDIUM when ENOMEDIUM is defined.
authorCyril Brulebois <kibi@debian.org>
Fri, 24 Jul 2009 15:42:08 +0000 (17:42 +0200)
committerLaMont Jones <lamont@debian.org>
Fri, 24 Jul 2009 16:18:06 +0000 (10:18 -0600)
ENOMEDIUM is Linux-only. On other systems, the open call on a CD-ROM
device without any medium may be successful and a subsequent read may
return EINVAL instead. Let's just break out of the loop if ENOMEDIUM
isn't defined.

Signed-off-by: Cyril Brulebois <kibi@debian.org>
Signed-off-by: LaMont Jones <lamont@debian.org>
lib/fsprobe.c

index b47de0ec93f12d2f715fb493d6b4a93e6ef7650b..04360dc838b4e681829b90d6555511c9f94e600d 100644 (file)
@@ -31,8 +31,13 @@ open_device(const char *devname)
                int fd = open(devname, O_RDONLY);
                if (fd >= 0)
                        return fd;
+#ifdef ENOMEDIUM
+               /* ENOMEDIUM is Linux-only */
                if (errno != ENOMEDIUM)
                        break;
+#else
+               break
+#endif
                if (retries >= CRDOM_NOMEDIUM_RETRIES)
                        break;
                ++retries;