diff options
author | Miklos Szeredi <miklos@szeredi.hu> | 2006-10-18 08:17:08 +0000 |
---|---|---|
committer | Miklos Szeredi <miklos@szeredi.hu> | 2006-10-18 08:17:08 +0000 |
commit | 87ad64c3ddc7e2f8b05eec8faaa10b5fa4a4ce02 (patch) | |
tree | ef95ee42e2d248ae0b03ffc8e9e9fd663c5bac8e /util | |
parent | dcfb82145049d85b6b859d906fa94cd2f0900091 (diff) |
fusermount: don't try to create a lock file if /etc/mtab is a symlink
Diffstat (limited to 'util')
-rw-r--r-- | util/fusermount.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/util/fusermount.c b/util/fusermount.c index dc30fde..014d4ea 100644 --- a/util/fusermount.c +++ b/util/fusermount.c @@ -108,6 +108,13 @@ static int lock_mtab(void) const char *mtab_lock = _PATH_MOUNTED ".fuselock"; int mtablock; int res; + struct stat mtab_stat; + + /* /etc/mtab could be a symlink to /proc/mounts */ + if (!lstat(_PATH_MOUNTED, &mtab_stat)) { + if (S_ISLNK(mtab_stat.st_mode)) + return -1; + } mtablock = open(mtab_lock, O_RDWR | O_CREAT, 0600); if (mtablock >= 0) { @@ -880,13 +887,8 @@ static int mount_fuse(const char *mnt, const char *opts) if (fd == -1) return -1; - if (geteuid() == 0) { + if (geteuid() == 0) mtablock = lock_mtab(); - if (mtablock < 0) { - close(fd); - return -1; - } - } drop_privs(); read_conf(); |