summaryrefslogtreecommitdiff
path: root/util-linux
diff options
context:
space:
mode:
authorDenys Vlasenko2009-12-12 22:17:44 +0100
committerDenys Vlasenko2009-12-12 22:17:44 +0100
commit3e97eeb408a1107b0ffacc6ba39682428c4598f1 (patch)
treef6f7df81821d543bef855f961a76b09e79d49855 /util-linux
parent8cbc300d083001bccac4f33bf61b9dc97f29cb04 (diff)
downloadbusybox-3e97eeb408a1107b0ffacc6ba39682428c4598f1.zip
busybox-3e97eeb408a1107b0ffacc6ba39682428c4598f1.tar.gz
apply post-1.15.2 fixes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'util-linux')
-rw-r--r--util-linux/mount.c24
1 files changed, 20 insertions, 4 deletions
diff --git a/util-linux/mount.c b/util-linux/mount.c
index 56c32e1..7784681 100644
--- a/util-linux/mount.c
+++ b/util-linux/mount.c
@@ -1958,6 +1958,7 @@ int mount_main(int argc UNUSED_PARAM, char **argv)
// If we're mounting all
} else {
+ struct mntent *mp;
// No, mount -a won't mount anything,
// even user mounts, for mere humans
if (nonroot)
@@ -1985,10 +1986,25 @@ int mount_main(int argc UNUSED_PARAM, char **argv)
// NFS mounts want this to be xrealloc-able
mtcur->mnt_opts = xstrdup(mtcur->mnt_opts);
- // Mount this thing
- if (singlemount(mtcur, 1)) {
- // Count number of failed mounts
- rc++;
+ // If nothing is mounted on this directory...
+ // (otherwise repeated "mount -a" mounts everything again)
+ mp = find_mount_point(mtcur->mnt_dir, /*subdir_too:*/ 0);
+ // We do not check fsname match of found mount point -
+ // "/" may have fsname of "/dev/root" while fstab
+ // says "/dev/something_else".
+ if (mp) {
+ if (verbose) {
+ bb_error_msg("according to %s, "
+ "%s is already mounted on %s",
+ bb_path_mtab_file,
+ mp->mnt_fsname, mp->mnt_dir);
+ }
+ } else {
+ // ...mount this thing
+ if (singlemount(mtcur, /*ignore_busy:*/ 1)) {
+ // Count number of failed mounts
+ rc++;
+ }
}
free(mtcur->mnt_opts);
}