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