summaryrefslogtreecommitdiffstats
path: root/misc-utils/eject.c
diff options
context:
space:
mode:
Diffstat (limited to 'misc-utils/eject.c')
-rw-r--r--misc-utils/eject.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/misc-utils/eject.c b/misc-utils/eject.c
index a0f409fe9..acea2a295 100644
--- a/misc-utils/eject.c
+++ b/misc-utils/eject.c
@@ -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"));