aboutsummaryrefslogtreecommitdiff
path: root/miscutils/eject.c
diff options
context:
space:
mode:
authorGravatar Denis Vlasenko <vda.linux@googlemail.com>2006-10-07 15:00:29 +0000
committerGravatar Denis Vlasenko <vda.linux@googlemail.com>2006-10-07 15:00:29 +0000
commitf7a57848c2a63957ef14b605c5f10b2691d36e73 (patch)
treea6c1d09c3f8c0937eaec2ad9cd35d19d125ff682 /miscutils/eject.c
parent96e9d3c968b252c0dac5b497c003e961bd408570 (diff)
downloadbusybox-f7a57848c2a63957ef14b605c5f10b2691d36e73.tar.gz
busybox-f7a57848c2a63957ef14b605c5f10b2691d36e73.tar.bz2
eject: remove unmounting. It is buggy for many non-trivial
mounts, and can be done as shell script.
Diffstat (limited to 'miscutils/eject.c')
-rw-r--r--miscutils/eject.c20
1 files changed, 8 insertions, 12 deletions
diff --git a/miscutils/eject.c b/miscutils/eject.c
index b07f536b1..ff23b1666 100644
--- a/miscutils/eject.c
+++ b/miscutils/eject.c
@@ -14,7 +14,6 @@
*/
#include "busybox.h"
-#include <mntent.h>
/* various defines swiped from linux/cdrom.h */
#define CDROMCLOSETRAY 0x5319 /* pendant of CDROMEJECT */
@@ -30,23 +29,20 @@ int eject_main(int argc, char **argv)
{
unsigned long flags;
char *device;
- struct mntent *m;
int dev, cmd;
opt_complementary = "?:?1:t--T:T--t";
flags = getopt32(argc, argv, "tT");
device = argv[optind] ? : "/dev/cdrom";
- // FIXME: what if something is mounted OVER our cdrom?
- // We will unmount something else??!
- // What if cdrom is mounted many times?
- m = find_mount_point(device, bb_path_mtab_file);
- if (m) {
- if (umount(m->mnt_dir))
- bb_error_msg_and_die("can't umount %s", device);
- if (ENABLE_FEATURE_MTAB_SUPPORT)
- erase_mtab(m->mnt_fsname);
- }
+ // We used to do "umount <device>" here, but it was buggy
+ // if something was mounted OVER cdrom and
+ // if cdrom is mounted many times.
+ //
+ // This works equally well (or better):
+ // #!/bin/sh
+ // umount /dev/cdrom
+ // eject
dev = xopen(device, O_RDONLY|O_NONBLOCK);
cmd = CDROMEJECT;