Blame SOURCES/libhugetlbfs-2.16-mounts_warning.patch

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