Magellan Linux

Annotation of /trunk/util-linux/patches/util-linux-2.12q-update-mtab-when-moving.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 153 - (hide annotations) (download)
Tue May 8 20:52:56 2007 UTC (17 years, 1 month ago) by niro
File size: 1036 byte(s)
-import

1 niro 153 Running `mount --move /foo /bar` would leave the old /foo entry in /etc/mtab
2     and create a new /bar entry with wrong info.
3    
4     http://bugs.gentoo.org/104697
5    
6     --- 1/mount/mount.c
7     +++ 2/mount/mount.c
8     @@ -665,6 +665,25 @@
9     else {
10     mntFILE *mfp;
11    
12     + /* when moving a mount point, we have to make sure the mtab
13     + * gets updated properly. We get info about the old mount
14     + * point, copy it to the new mount point, and then delete
15     + * the old mount point. */
16     + if (flags & MS_MOVE) {
17     + const char *olddir = mnt.mnt_fsname;
18     + struct mntentchn *oldmc = oldmc = getmntfile(olddir);
19     + if (oldmc != NULL) {
20     + mnt.mnt_fsname = xstrdup(oldmc->m.mnt_fsname);
21     + mnt.mnt_type = oldmc->m.mnt_type;
22     + mnt.mnt_opts = oldmc->m.mnt_opts;
23     + mnt.mnt_freq = oldmc->m.mnt_freq;
24     + mnt.mnt_passno = oldmc->m.mnt_passno;
25     + }
26     + update_mtab(olddir, NULL);
27     + if (oldmc != NULL)
28     + my_free(olddir);
29     + }
30     +
31     lock_mtab();
32     mfp = my_setmntent(MOUNTED, "a+");
33     if (mfp == NULL || mfp->mntent_fp == NULL) {