Skip to content

Commit

Permalink
Merge pull request #23 from billziss-gh/master
Browse files Browse the repository at this point in the history
Port SSHFS to Cygwin
  • Loading branch information
Nikratio authored Jan 12, 2017
2 parents 96c6138 + efeed71 commit f627055
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions sshfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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);
Expand All @@ -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,
Expand Down

0 comments on commit f627055

Please sign in to comment.