diff options
author | Sami Kerola | 2012-06-10 22:03:57 +0200 |
---|---|---|
committer | Sami Kerola | 2012-06-11 22:06:05 +0200 |
commit | f31d041aaf0d63442b8c166f9be3eea5cb608f63 (patch) | |
tree | 48e82a2a335b79cc1d5649b2dac73f251f9db88d /sys-utils/eject.c | |
parent | docs: clean up partx.8 manual (diff) | |
download | kernel-qcow2-util-linux-f31d041aaf0d63442b8c166f9be3eea5cb608f63.tar.gz kernel-qcow2-util-linux-f31d041aaf0d63442b8c166f9be3eea5cb608f63.tar.xz kernel-qcow2-util-linux-f31d041aaf0d63442b8c166f9be3eea5cb608f63.zip |
eject: inform if CD-ROM drive is not ready
Include file (see linux/cdrom.h lines 395 and 398) suggests ioctl() can
return CDS_NO_INFO and CDS_DRIVE_NOT_READY, which where ignored. This
commit will tell user what is going on.
The commit will also make eject to crash in ioctl() will return
unexpected value.
Reference: http://git.kernel.org/?p=linux/kernel/git/torvalds/linux.git;a=blob;f=include/linux/cdrom.h;h=dfd7f187c351440d2ffa81050e46ed2602877f73;hb=HEAD
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Diffstat (limited to 'sys-utils/eject.c')
-rw-r--r-- | sys-utils/eject.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/sys-utils/eject.c b/sys-utils/eject.c index 4f3fb831f..68f1f8504 100644 --- a/sys-utils/eject.c +++ b/sys-utils/eject.c @@ -429,6 +429,14 @@ static void toggle_tray(int fd) if (eject_cdrom(fd)) err(EXIT_FAILURE, _("CD-ROM eject command failed")); return; + case CDS_NO_INFO: + warnx(_("no CD-ROM information available")); + return; + case CDS_DRIVE_NOT_READY: + warnx(_("CD-ROM drive is not ready")); + return; + default: + abort(); } #endif |