aboutsummaryrefslogtreecommitdiff
path: root/lib/helper.c
diff options
context:
space:
mode:
authorGravatar Miklos Szeredi <miklos@szeredi.hu>2007-08-08 18:22:01 +0000
committerGravatar Miklos Szeredi <miklos@szeredi.hu>2007-08-08 18:22:01 +0000
commit0042f8cc82e98b51defcf28b8e84f47f443cb55a (patch)
tree46c4e37a048d1a67ff9516befda5fdbfda8de7ba /lib/helper.c
parent66455c648efb5325c3d1d9691d3b8b255a4cf6a7 (diff)
fixes
Diffstat (limited to 'lib/helper.c')
-rw-r--r--lib/helper.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/lib/helper.c b/lib/helper.c
index d7cc9b7..b282da9 100644
--- a/lib/helper.c
+++ b/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;