Merge pull request #23 from billziss-gh/master

Port SSHFS to Cygwin
This commit is contained in:
Nikolaus Rath 2017-01-12 14:57:45 -08:00 committed by GitHub
commit f627055bc7
1 changed files with 10 additions and 0 deletions

10
sshfs.c
View File

@ -11,7 +11,9 @@
#include <fuse.h>
#include <fuse_opt.h>
#if !defined(__CYGWIN__)
#include <fuse_lowlevel.h>
#endif
#ifdef __APPLE__
# include <fuse_darwin.h>
#endif
@ -4113,7 +4115,9 @@ int main(int argc, char *argv[])
char *mountpoint;
int multithreaded;
int foreground;
#if !defined(__CYGWIN__)
struct stat st;
#endif
res = fuse_parse_cmdline(&args, &mountpoint, &multithreaded,
&foreground);
@ -4125,20 +4129,26 @@ int main(int argc, char *argv[])
foreground = 1;
}
#if !defined(__CYGWIN__)
res = stat(mountpoint, &st);
if (res == -1) {
perror(mountpoint);
exit(1);
}
sshfs.mnt_mode = st.st_mode;
#elif defined(__CYGWIN__)
sshfs.mnt_mode = S_IFDIR | 0755;
#endif
ch = fuse_mount(mountpoint, &args);
if (!ch)
exit(1);
#if !defined(__CYGWIN__)
res = fcntl(fuse_chan_fd(ch), F_SETFD, FD_CLOEXEC);
if (res == -1)
perror("WARNING: failed to set FD_CLOEXEC on fuse device");
#endif
sshfs.op = cache_init(&sshfs_oper);
fuse = fuse_new(ch, &args, sshfs.op,