aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorvda <vda@69ca8d6d-28ef-0310-b511-8ec308f3f277>2006-10-07 15:00:29 +0000
committervda <vda@69ca8d6d-28ef-0310-b511-8ec308f3f277>2006-10-07 15:00:29 +0000
commit8872dfacf0da5f3594c835b8f31a447422e61331 (patch)
treea6c1d09c3f8c0937eaec2ad9cd35d19d125ff682
parent9f5aad94ef36ec0c1ccd020db9ada54b451acfb8 (diff)
downloadbusybox-w32-8872dfacf0da5f3594c835b8f31a447422e61331.tar.gz
busybox-w32-8872dfacf0da5f3594c835b8f31a447422e61331.tar.bz2
busybox-w32-8872dfacf0da5f3594c835b8f31a447422e61331.zip
eject: remove unmounting. It is buggy for many non-trivial
mounts, and can be done as shell script. git-svn-id: svn://busybox.net/trunk/busybox@16338 69ca8d6d-28ef-0310-b511-8ec308f3f277
-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 @@
14 */ 14 */
15 15
16#include "busybox.h" 16#include "busybox.h"
17#include <mntent.h>
18 17
19/* various defines swiped from linux/cdrom.h */ 18/* various defines swiped from linux/cdrom.h */
20#define CDROMCLOSETRAY 0x5319 /* pendant of CDROMEJECT */ 19#define CDROMCLOSETRAY 0x5319 /* pendant of CDROMEJECT */
@@ -30,23 +29,20 @@ int eject_main(int argc, char **argv)
30{ 29{
31 unsigned long flags; 30 unsigned long flags;
32 char *device; 31 char *device;
33 struct mntent *m;
34 int dev, cmd; 32 int dev, cmd;
35 33
36 opt_complementary = "?:?1:t--T:T--t"; 34 opt_complementary = "?:?1:t--T:T--t";
37 flags = getopt32(argc, argv, "tT"); 35 flags = getopt32(argc, argv, "tT");
38 device = argv[optind] ? : "/dev/cdrom"; 36 device = argv[optind] ? : "/dev/cdrom";
39 37
40 // FIXME: what if something is mounted OVER our cdrom? 38 // We used to do "umount <device>" here, but it was buggy
41 // We will unmount something else??! 39 // if something was mounted OVER cdrom and
42 // What if cdrom is mounted many times? 40 // if cdrom is mounted many times.
43 m = find_mount_point(device, bb_path_mtab_file); 41 //
44 if (m) { 42 // This works equally well (or better):
45 if (umount(m->mnt_dir)) 43 // #!/bin/sh
46 bb_error_msg_and_die("can't umount %s", device); 44 // umount /dev/cdrom
47 if (ENABLE_FEATURE_MTAB_SUPPORT) 45 // eject
48 erase_mtab(m->mnt_fsname);
49 }
50 46
51 dev = xopen(device, O_RDONLY|O_NONBLOCK); 47 dev = xopen(device, O_RDONLY|O_NONBLOCK);
52 cmd = CDROMEJECT; 48 cmd = CDROMEJECT;