From c0f07c8b674f8cb6280925711bf40b95fad2fd2d Mon Sep 17 00:00:00 2001 From: Cyril Brulebois Date: Fri, 24 Jul 2009 17:42:08 +0200 Subject: [PATCH] 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 --- lib/fsprobe.c | 5 +++++ 1 file changed, 5 insertions(+) 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; -- 2.39.5