Changeset 3621 in MondoRescue for branches/3.3/mindi-busybox/util-linux/umount.c
- Timestamp:
- Dec 20, 2016, 4:07:32 PM (7 years ago)
- Location:
- branches/3.3
- Files:
-
- 1 edited
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
branches/3.3/mindi-busybox/util-linux/umount.c
r3232 r3621 31 31 #include <mntent.h> 32 32 #include <sys/mount.h> 33 #ifndef MNT_DETACH 34 # define MNT_DETACH 0x00000002 35 #endif 33 36 #include "libbb.h" 37 #include "common_bufsiz.h" 34 38 35 39 #if defined(__dietlibc__) … … 82 86 83 87 // MNT_FORCE and MNT_DETACH (from linux/fs.h) must match 84 // OPT_FORCE and OPT_LAZY, otherwise this trick won't work: 85 doForce = MAX((opt & OPT_FORCE), (opt & OPT_LAZY)); 88 // OPT_FORCE and OPT_LAZY. 89 BUILD_BUG_ON(OPT_FORCE != MNT_FORCE || OPT_LAZY != MNT_DETACH); 90 doForce = opt & (OPT_FORCE|OPT_LAZY); 86 91 87 92 /* Get a list of mount points from mtab. We read them all in now mostly … … 99 104 bb_error_msg_and_die("can't open '%s'", bb_path_mtab_file); 100 105 } else { 101 while (getmntent_r(fp, &me, bb_common_bufsiz1, sizeof(bb_common_bufsiz1))) { 106 setup_common_bufsiz(); 107 while (getmntent_r(fp, &me, bb_common_bufsiz1, COMMON_BUFSIZE)) { 102 108 /* Match fstype if passed */ 103 109 if (!match_fstype(&me, fstype)) … … 148 154 if (m) zapit = m->dir; 149 155 156 // umount from util-linux 2.22.2 does not do this: 157 // umount -f uses umount2(MNT_FORCE) immediately, 158 // not trying umount() first. 159 // (Strangely, umount -fl ignores -f: it is equivalent to umount -l. 160 // We do pass both flags in this case) 161 #if 0 150 162 // Let's ask the thing nicely to unmount. 151 163 curstat = umount(zapit); 152 164 153 // Force the unmount, if necessary.165 // Unmount with force and/or lazy flags, if necessary. 154 166 if (curstat && doForce) 167 #endif 155 168 curstat = umount2(zapit, doForce); 156 169 … … 169 182 } else { 170 183 status = EXIT_FAILURE; 171 bb_perror_msg("can't %sumount %s", (doForce ? "forcibly " : ""), zapit);184 bb_perror_msg("can't unmount %s", zapit); 172 185 } 173 186 } else {
Note:
See TracChangeset
for help on using the changeset viewer.