diff options
Diffstat (limited to 'sshfs.c')
-rw-r--r-- | sshfs.c | 18 |
1 files changed, 12 insertions, 6 deletions
@@ -11,6 +11,7 @@ #include <fuse.h> #include <fuse_opt.h> +#include <fuse_lowlevel.h> #include <assert.h> #include <stdio.h> #include <stdlib.h> @@ -3341,6 +3342,10 @@ int main(int argc, char *argv[]) if (!ch) exit(1); + res = fcntl(fuse_chan_fd(ch), F_SETFD, FD_CLOEXEC); + if (res == -1) + perror("WARNING: failed to set FD_CLOESEC on fuse device"); + fuse = fuse_new(ch, &args, cache_init(&sshfs_oper), sizeof(struct fuse_operations), NULL); if (fuse == NULL) { @@ -3348,19 +3353,20 @@ int main(int argc, char *argv[]) exit(1); } - res = fuse_daemonize(foreground); - if (res != -1) - res = fuse_set_signal_handlers(fuse_get_session(fuse)); - + res = ssh_connect(); if (res == -1) { fuse_unmount(mountpoint, ch); fuse_destroy(fuse); exit(1); } - res = ssh_connect(); + res = fuse_daemonize(foreground); + if (res != -1) + res = fuse_set_signal_handlers(fuse_get_session(fuse)); + if (res == -1) { - fuse_teardown(fuse, mountpoint); + fuse_unmount(mountpoint, ch); + fuse_destroy(fuse); exit(1); } |