fix: the driver didn't work if the standard I/O file descriptors were closed
during mount, e.g. via some configuration of udev/hotplug (Ugo Riboni, laoGe)master
parent
ff1e14e4fb
commit
ed96bb15e5
|
@ -160,16 +160,6 @@ static struct fuse_chan *fuse_mount_common(const char *mountpoint,
|
|||
struct fuse_chan *ch;
|
||||
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_kern_mount(mountpoint, args);
|
||||
if (fd == -1)
|
||||
return NULL;
|
||||
|
|
|
@ -2231,7 +2231,17 @@ int main(int argc, char *argv[])
|
|||
struct fuse *fh;
|
||||
fuse_fstype fstype = FSTYPE_UNKNOWN;
|
||||
struct stat sbuf;
|
||||
int err;
|
||||
int err, 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);
|
||||
|
||||
#ifndef FUSE_INTERNAL
|
||||
if ((getuid() != geteuid()) || (getgid() != getegid())) {
|
||||
|
|
Loading…
Reference in New Issue