From 0042f8cc82e98b51defcf28b8e84f47f443cb55a Mon Sep 17 00:00:00 2001 From: Miklos Szeredi Date: Wed, 8 Aug 2007 18:22:01 +0000 Subject: fixes --- lib/helper.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'lib/helper.c') 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; -- cgit v1.2.3