Blame SOURCES/libhugetlbfs-2.16-mounts_warning.patch

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