aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBill Zissimopoulos <billziss@navimatics.com>2016-06-22 17:02:30 -0700
committerBill Zissimopoulos <billziss@navimatics.com>2016-06-22 17:02:30 -0700
commita175c2876ac65235affaa07d81ecd904034734a1 (patch)
treea886f47c0ae11c3e2d50d53f63ec4b924f31f1d4
parentb2fa7593586b141298e6159f40f521d2b0f4f894 (diff)
downloadsshfs-a175c2876ac65235affaa07d81ecd904034734a1.tar
sshfs-a175c2876ac65235affaa07d81ecd904034734a1.tar.gz
sshfs-a175c2876ac65235affaa07d81ecd904034734a1.tar.bz2
sshfs-a175c2876ac65235affaa07d81ecd904034734a1.zip
port sshfs to cygwin
-rw-r--r--configure.ac1
-rw-r--r--sshfs.c10
2 files changed, 11 insertions, 0 deletions
diff --git a/configure.ac b/configure.ac
index 7c0cdd1..7fa6969 100644
--- a/configure.ac
+++ b/configure.ac
@@ -49,6 +49,7 @@ have_fuse_opt_parse=no
oldlibs="$LIBS"
LIBS="$LIBS $SSHFS_LIBS"
AC_CHECK_FUNC([fuse_opt_parse], [have_fuse_opt_parse=yes])
+AC_CHECK_FUNC([fsp_fuse_opt_parse], [have_fuse_opt_parse=yes])
LIBS="$oldlibs"
if test "$have_fuse_opt_parse" = no -o "$osname" = darwin; then
CFLAGS="$CFLAGS -I${srcdir}/compat"
diff --git a/sshfs.c b/sshfs.c
index f41d987..3186867 100644
--- a/sshfs.c
+++ b/sshfs.c
@@ -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
@@ -4108,7 +4110,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);
@@ -4120,20 +4124,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,