Blame SOURCES/libhugetlbfs-2.16-mounts_warning.patch

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