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