]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
eject: new close_tray code from Fedora
authorKarel Zak <kzak@redhat.com>
Tue, 27 Mar 2012 15:49:38 +0000 (17:49 +0200)
committerKarel Zak <kzak@redhat.com>
Tue, 27 Mar 2012 15:49:38 +0000 (17:49 +0200)
Signed-off-by: Karel Zak <kzak@redhat.com>
misc-utils/eject.c

index a0f409fe998971a11eea3a32b20568fdd793bbac..acea2a295c2f38c1f247059088132c94938325f3 100644 (file)
@@ -362,8 +362,15 @@ static void changer_select(int fd, int slot)
  */
 static void close_tray(int fd)
 {
-#ifdef CDROMCLOSETRAY
-       if (ioctl(fd, CDROMCLOSETRAY) != 0)
+       int status;
+
+#if defined(CDROMCLOSETRAY) || defined(CDIOCCLOSE)
+#if defined(CDROMCLOSETRAY)
+       status = ioctl(fd, CDROMCLOSETRAY);
+#elif defined(CDIOCCLOSE)
+       status = ioctl(fd, CDIOCCLOSE);
+#endif
+       if (status != 0)
                err(EXIT_FAILURE, _("CD-ROM tray close command failed"));
 #else
        warnx(_("CD-ROM tray close command not supported by this kernel\n"));