]> git.decadent.org.uk Git - nfs-utils.git/blob - debian/patches/03-handle-mtab-symlink.patch
Merge branch 'sid'
[nfs-utils.git] / debian / patches / 03-handle-mtab-symlink.patch
1 --- a/utils/mount/fstab.c       2010-02-18 23:35:00.000000000 +1100
2 +++ b/utils/mount/fstab.c       2010-04-06 16:12:51.000000000 +1000
3 @@ -57,7 +57,7 @@ mtab_does_not_exist(void) {
4         return var_mtab_does_not_exist;
5  }
6  
7 -static int
8 +int
9  mtab_is_a_symlink(void) {
10          get_mtab_info();
11          return var_mtab_is_a_symlink;
12 --- a/utils/mount/fstab.h       2010-02-18 23:35:00.000000000 +1100
13 +++ b/utils/mount/fstab.h       2010-04-06 16:12:51.000000000 +1000
14 @@ -7,6 +7,7 @@
15  #define _PATH_FSTAB "/etc/fstab"
16  #endif
17  
18 +int mtab_is_a_symlink(void);
19  int mtab_is_writable(void);
20  int mtab_does_not_exist(void);
21  void reset_mtab_info(void);
22 --- a/utils/mount/mount.c       2010-02-18 23:35:00.000000000 +1100
23 +++ b/utils/mount/mount.c       2010-04-06 16:12:51.000000000 +1000
24 @@ -232,6 +232,13 @@ create_mtab (void) {
25         int flags;
26         mntFILE *mfp;
27  
28 +       /* Avoid writing if the mtab is a symlink to /proc/mounts, since
29 +          that would create a file /proc/mounts in case the proc filesystem
30 +          is not mounted, and the fchmod below would also fail. */
31 +       if (mtab_is_a_symlink()) {
32 +               return EX_SUCCESS;
33 +       }
34 +
35         lock_mtab();
36  
37         mfp = nfs_setmntent (MOUNTED, "a+");