mirror of
https://github.com/libfuse/libfuse.git
synced 2024-11-26 21:54:30 +08:00
fixes
This commit is contained in:
parent
66455c648e
commit
0042f8cc82
@ -1,8 +1,16 @@
|
||||
2007-07-31 Miklos Szeredi <miklos@szeredi.hu>
|
||||
|
||||
* Work around hotplug issue, that it calls filesystem with file
|
||||
descriptors 0, 1 and 2 not open. Tracked down by Leif Johnson
|
||||
|
||||
2007-07-25 Miklos Szeredi <miklos@szeredi.hu>
|
||||
|
||||
* Don't call /bin/[u]mount if /etc/mtab is a symlink. Reported by
|
||||
Tomas M
|
||||
|
||||
* Also don't touch /etc/mtab if it is within the mounted
|
||||
filesystem. Suggested by Jeffrey Law
|
||||
|
||||
2007-07-12 Miklos Szeredi <miklos@szeredi.hu>
|
||||
|
||||
* Reset args->argc in fuse_opt_free_args(). Patch by Lucas
|
||||
|
14
lib/helper.c
14
lib/helper.c
@ -190,7 +190,19 @@ static struct fuse_chan *fuse_mount_common(const char *mountpoint,
|
||||
struct fuse_args *args)
|
||||
{
|
||||
struct fuse_chan *ch;
|
||||
int fd = fuse_mount_compat25(mountpoint, args);
|
||||
int fd;
|
||||
|
||||
/*
|
||||
* Make sure file descriptors 0, 1 and 2 are open, otherwise chaos
|
||||
* would ensue.
|
||||
*/
|
||||
do {
|
||||
fd = open("/dev/null", O_RDWR);
|
||||
if (fd > 2)
|
||||
close(fd);
|
||||
} while (fd >= 0 && fd <= 2);
|
||||
|
||||
fd = fuse_mount_compat25(mountpoint, args);
|
||||
if (fd == -1)
|
||||
return NULL;
|
||||
|
||||
|
@ -18,14 +18,19 @@
|
||||
#include <sys/stat.h>
|
||||
#include <sys/wait.h>
|
||||
|
||||
static int mtab_is_symlink(void)
|
||||
static int mtab_needs_update(const char *mnt)
|
||||
{
|
||||
struct stat stbuf;
|
||||
|
||||
if (lstat(_PATH_MOUNTED, &stbuf) != -1 && S_ISLNK(stbuf.st_mode))
|
||||
return 1;
|
||||
else
|
||||
/* If mtab is within new mount, don't touch it */
|
||||
if (strncmp(mnt, _PATH_MOUNTED, strlen(mnt)) == 0 &&
|
||||
_PATH_MOUNTED[strlen(mnt)] == '/')
|
||||
return 0;
|
||||
|
||||
if (lstat(_PATH_MOUNTED, &stbuf) != -1 && S_ISLNK(stbuf.st_mode))
|
||||
return 0;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
int fuse_mnt_add_mount(const char *progname, const char *fsname,
|
||||
@ -34,7 +39,7 @@ int fuse_mnt_add_mount(const char *progname, const char *fsname,
|
||||
int res;
|
||||
int status;
|
||||
|
||||
if (mtab_is_symlink())
|
||||
if (!mtab_needs_update(mnt))
|
||||
return 0;
|
||||
|
||||
res = fork();
|
||||
@ -86,7 +91,7 @@ int fuse_mnt_umount(const char *progname, const char *mnt, int lazy)
|
||||
int res;
|
||||
int status;
|
||||
|
||||
if (mtab_is_symlink())
|
||||
if (!mtab_needs_update(mnt))
|
||||
return 0;
|
||||
|
||||
res = fork();
|
||||
|
Loading…
Reference in New Issue
Block a user