svn commit: trunk/busybox/miscutils

vda at busybox.net vda at busybox.net
Sat Oct 7 15:00:30 UTC 2006


Author: vda
Date: 2006-10-07 08:00:29 -0700 (Sat, 07 Oct 2006)
New Revision: 16338

Log:
eject: remove unmounting. It is buggy for many non-trivial
mounts, and can be done as shell script.


Modified:
   trunk/busybox/miscutils/eject.c


Changeset:
Modified: trunk/busybox/miscutils/eject.c
===================================================================
--- trunk/busybox/miscutils/eject.c	2006-10-07 14:28:55 UTC (rev 16337)
+++ trunk/busybox/miscutils/eject.c	2006-10-07 15:00:29 UTC (rev 16338)
@@ -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 @@
 {
 	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;




More information about the busybox-cvs mailing list