From: Cyril Brulebois Date: Fri, 24 Jul 2009 15:42:08 +0000 (+0200) Subject: Only check for ENOMEDIUM when ENOMEDIUM is defined. X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c0f07c8b674f8cb6280925711bf40b95fad2fd2d;p=util-linux Only check for ENOMEDIUM when ENOMEDIUM is defined. 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 Signed-off-by: LaMont Jones --- diff --git a/lib/fsprobe.c b/lib/fsprobe.c index b47de0ec..04360dc8 100644 --- a/lib/fsprobe.c +++ b/lib/fsprobe.c @@ -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;