util-linux.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dave Reisner <dreisner@archlinux.org>
To: util-linux@vger.kernel.org
Cc: Dave Reisner <dreisner@archlinux.org>
Subject: [PATCH] eject: return proper 0/1 from eject_cdrom()
Date: Mon,  6 Aug 2012 11:16:12 -0400	[thread overview]
Message-ID: <1344266172-8818-1-git-send-email-dreisner@archlinux.org> (raw)

main() expects this method to return 0 for failure and 1 for success, as
the other eject_*() methods do. Add the missing comparison of ioctl() >= 0

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
---
 sys-utils/eject.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/sys-utils/eject.c b/sys-utils/eject.c
index 08af08e..84bd342 100644
--- a/sys-utils/eject.c
+++ b/sys-utils/eject.c
@@ -398,9 +398,9 @@ static void close_tray(int fd)
 static int eject_cdrom(int fd)
 {
 #if defined(CDROMEJECT)
-	return ioctl(fd, CDROMEJECT);
+	return ioctl(fd, CDROMEJECT) >= 0;
 #elif defined(CDIOCEJECT)
-	return ioctl(fd, CDIOCEJECT);
+	return ioctl(fd, CDIOCEJECT) >= 0;
 #else
 	warnx(_("CD-ROM eject unsupported"));
 	errno = ENOSYS;
-- 
1.7.11.4


             reply	other threads:[~2012-08-06 15:22 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-08-06 15:16 Dave Reisner [this message]
2012-08-13 13:48 ` [PATCH] eject: return proper 0/1 from eject_cdrom() Karel Zak
2012-08-13 14:44   ` Dave Reisner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1344266172-8818-1-git-send-email-dreisner@archlinux.org \
    --to=dreisner@archlinux.org \
    --cc=util-linux@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).