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