Handle /etc/mtab -> /proc/mounts symlink

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
This commit is contained in:
Brian Behlendorf 2011-06-14 16:25:29 -07:00
parent 2e08aedba4
commit e130330a87

View File

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