From 48a2130c28b0078a5db530c6366da08e31c1135b Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Tue, 27 Mar 2012 17:49:38 +0200 Subject: eject: new close_tray code from Fedora Signed-off-by: Karel Zak --- misc-utils/eject.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'misc-utils/eject.c') 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")); -- cgit v1.2.3-55-g7522