2007-04-12 18:31:42 +02:00
|
|
|
Index: mount/mount.c
|
|
|
|
===================================================================
|
|
|
|
--- mount/mount.c.orig
|
2006-12-19 00:18:10 +01:00
|
|
|
+++ mount/mount.c
|
2007-04-12 18:31:42 +02:00
|
|
|
@@ -760,6 +760,25 @@ update_mtab_entry(const char *spec, cons
|
2006-12-19 00:18:10 +01:00
|
|
|
else {
|
|
|
|
mntFILE *mfp;
|
|
|
|
|
|
|
|
+ /* when moving a mount point, we have to make sure the mtab
|
|
|
|
+ * gets updated properly. We get info about the old mount
|
|
|
|
+ * point, copy it to the new mount point, and then delete
|
|
|
|
+ * the old mount point. */
|
|
|
|
+ if (flags & MS_MOVE) {
|
|
|
|
+ const char *olddir = mnt.mnt_fsname;
|
|
|
|
+ struct mntentchn *oldmc = oldmc = getmntfile(olddir);
|
|
|
|
+ if (oldmc != NULL) {
|
|
|
|
+ mnt.mnt_fsname = strdup(oldmc->m.mnt_fsname);
|
|
|
|
+ mnt.mnt_type = oldmc->m.mnt_type;
|
|
|
|
+ mnt.mnt_opts = oldmc->m.mnt_opts;
|
|
|
|
+ mnt.mnt_freq = oldmc->m.mnt_freq;
|
|
|
|
+ mnt.mnt_passno = oldmc->m.mnt_passno;
|
|
|
|
+ }
|
|
|
|
+ update_mtab(olddir, NULL);
|
|
|
|
+ if (oldmc != NULL)
|
|
|
|
+ my_free(olddir);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
lock_mtab();
|
|
|
|
mfp = my_setmntent(MOUNTED, "a+");
|
|
|
|
if (mfp == NULL || mfp->mntent_fp == NULL) {
|