aboutsummaryrefslogtreecommitdiff
path: root/lib/helper.c
diff options
context:
space:
mode:
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;