]> git.proxmox.com Git - mirror_zfs.git/commitdiff
Handle /etc/mtab -> /proc/mounts symlink
authorBrian Behlendorf <behlendorf1@llnl.gov>
Tue, 14 Jun 2011 23:25:29 +0000 (16:25 -0700)
committerBrian Behlendorf <behlendorf1@llnl.gov>
Tue, 14 Jun 2011 23:48:38 +0000 (16:48 -0700)
Under Fedora 15 /etc/mtab is now a symlink to /proc/mounts by
default.  When /etc/mtab is a symlink the mount.zfs helper
should not update it.   There was code in place to handle this
case but it used stat() which traverses the link and then issues
the stat on /proc/mounts.  We need to use lstat() to prevent the
link traversal and instead stat /etc/mtab.

Closes #270

cmd/mount_zfs/mount_zfs.c

index e97b2b8a5f8822fc7c11e144369e1385af4ec5fc..7173f5698f51fbf095b4df888c50cff53c233008 100644 (file)
@@ -252,7 +252,7 @@ mtab_is_writeable(void)
        struct stat st;
        int error, fd;
 
-       error = stat(MNTTAB, &st);
+       error = lstat(MNTTAB, &st);
        if (error || S_ISLNK(st.st_mode))
                return (0);