If /etc/mtab is a symlink to /proc/self/mounts,
mounting fails because addmntent returns an error.
As a consequence, the Private directory is unusable.
This is a patch which checks if /etc/mtab is a symlink,
and if so, doesn't try to call addmntent.

Signed-off-by: Chunrong Guo <b40...@freescale.com>
---
 hugeadm.c |   11 +++++++++++
 1 files changed, 11 insertions(+), 0 deletions(-)

diff --git a/hugeadm.c b/hugeadm.c
index 781f23c..93a4094 100644
--- a/hugeadm.c
+++ b/hugeadm.c
@@ -516,6 +516,9 @@ int mount_dir(char *path, char *options, mode_t mode, uid_t 
uid, gid_t gid)
        struct group *grp;
        struct mntent entry;
        FILE *mounts;
+        char dummy;
+        int useMtab;  
+      
        struct mount_list *list, *previous;
 
        list = collect_active_mounts(NULL);
@@ -552,6 +555,14 @@ int mount_dir(char *path, char *options, mode_t mode, 
uid_t uid, gid_t gid)
                        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;
-- 
1.7.5.4



------------------------------------------------------------------------------
Get your SQL database under version control now!
Version control is standard for application code, but databases havent 
caught up. So what steps can you take to put your SQL databases under 
version control? Why should you start doing it? Read more to find out.
http://pubads.g.doubleclick.net/gampad/clk?id=48897031&iu=/4140/ostg.clktrk
_______________________________________________
Libhugetlbfs-devel mailing list
Libhugetlbfs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libhugetlbfs-devel

Reply via email to