diff options
author | Karel Zak | 2007-04-12 13:27:41 +0200 |
---|---|---|
committer | Karel Zak | 2007-04-25 00:08:43 +0200 |
commit | 0b44c6155b8430fdf832fabc42d3f4b8dfa9f072 (patch) | |
tree | 295f396f6d017b540479fae18b4e00fb3686fc50 /mount | |
parent | schedutils: define SCHED_BATCH when compile with old glibc (diff) | |
download | kernel-qcow2-util-linux-0b44c6155b8430fdf832fabc42d3f4b8dfa9f072.tar.gz kernel-qcow2-util-linux-0b44c6155b8430fdf832fabc42d3f4b8dfa9f072.tar.xz kernel-qcow2-util-linux-0b44c6155b8430fdf832fabc42d3f4b8dfa9f072.zip |
mount: update mtab correctly when mount --move
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'mount')
-rw-r--r-- | mount/fstab.c | 6 | ||||
-rw-r--r-- | mount/mount.c | 4 |
2 files changed, 8 insertions, 2 deletions
diff --git a/mount/fstab.c b/mount/fstab.c index bdcc7a674..1e186c194 100644 --- a/mount/fstab.c +++ b/mount/fstab.c @@ -638,9 +638,13 @@ update_mtab (const char *dir, struct my_mntent *instead) { mc->nxt->prev = mc->prev; free(mc); } - } else { + } else if (!strcmp(mc->m.mnt_dir, instead->mnt_dir)) { /* A remount */ mc->m.mnt_opts = instead->mnt_opts; + } else { + /* A move */ + my_free(mc->m.mnt_dir); + mc->m.mnt_dir = xstrdup(instead->mnt_dir); } } else if (instead) { /* not found, add a new entry */ diff --git a/mount/mount.c b/mount/mount.c index 63e673135..1360d235d 100644 --- a/mount/mount.c +++ b/mount/mount.c @@ -752,7 +752,7 @@ update_mtab_entry(const char *spec, const char *node, const char *type, mnt.mnt_opts = opts; mnt.mnt_freq = freq; mnt.mnt_passno = pass; - + /* We get chatty now rather than after the update to mtab since the mount succeeded, even if the write to /etc/mtab should fail. */ if (verbose) @@ -761,6 +761,8 @@ update_mtab_entry(const char *spec, const char *node, const char *type, if (!nomtab && mtab_is_writable()) { if (flags & MS_REMOUNT) update_mtab (mnt.mnt_dir, &mnt); + else if (flags & MS_MOVE) + update_mtab(mnt.mnt_fsname, &mnt); else { mntFILE *mfp; |