From: Karel Zak Date: Tue, 27 Mar 2012 15:49:38 +0000 (+0200) Subject: eject: new close_tray code from Fedora X-Git-Tag: v2.22-rc1~555^2~15 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=48a2130c28b0078a5db530c6366da08e31c1135b;p=thirdparty%2Futil-linux.git eject: new close_tray code from Fedora Signed-off-by: Karel Zak --- diff --git a/misc-utils/eject.c b/misc-utils/eject.c index a0f409fe99..acea2a295c 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"));