summaryrefslogtreecommitdiffstats
path: root/misc-utils/eject.c
diff options
context:
space:
mode:
authorKarel Zak2012-03-27 17:49:38 +0200
committerKarel Zak2012-03-27 17:49:38 +0200
commit48a2130c28b0078a5db530c6366da08e31c1135b (patch)
tree1133df8f248ac7f5f3ab7ab014a6ca804c9cb4ed /misc-utils/eject.c
parenteject: new auto_eject code from Fedora (diff)
downloadkernel-qcow2-util-linux-48a2130c28b0078a5db530c6366da08e31c1135b.tar.gz
kernel-qcow2-util-linux-48a2130c28b0078a5db530c6366da08e31c1135b.tar.xz
kernel-qcow2-util-linux-48a2130c28b0078a5db530c6366da08e31c1135b.zip
eject: new close_tray code from Fedora
Signed-off-by: Karel Zak <kzak@redhat.com>
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"));