Blob Blame History Raw
diff -up libhugetlbfs-2.16/hugeadm.c.orig libhugetlbfs-2.16/hugeadm.c
--- libhugetlbfs-2.16/hugeadm.c.orig	2014-07-29 18:36:06.572447296 +0200
+++ libhugetlbfs-2.16/hugeadm.c	2014-07-29 18:36:40.877511388 +0200
@@ -517,6 +517,8 @@ int mount_dir(char *path, char *options,
 	struct mntent entry;
 	FILE *mounts;
 	struct mount_list *list, *previous;
+	char dummy;
+	int useMtab;
 
 	list = collect_active_mounts(NULL);
 
@@ -552,6 +554,15 @@ int mount_dir(char *path, char *options,
 			return 1;
 		}
 
+	/* Check if mtab is a symlink */
+	useMtab = (readlink(MOUNTED, &dummy, 1) < 0);
+	if (!useMtab) {
+		/* No need updating mtab */
+		return 0;
+	}
+
+
+
 		mounts = setmntent(MOUNTED, "a+");
 		if (mounts) {
 			entry.mnt_fsname = FS_NAME;