Merge pull request #7 from ALPHA-60/master
[perl-fuse.git] / Fuse.xs
diff --git a/Fuse.xs b/Fuse.xs
index ca931c8..f86995d 100755 (executable)
--- a/Fuse.xs
+++ b/Fuse.xs
@@ -3,9 +3,15 @@
 #include "perl.h"
 #include "XSUB.h"
 
-#include <sys/xattr.h>
 #include <fuse.h>
 
+#if defined(__FreeBSD__) || defined(__NetBSD__)
+# define XATTR_CREATE 1
+# define XATTR_REPLACE 2
+#else
+# include <sys/xattr.h>
+#endif
+
 /* Determine if threads support should be included */
 #ifdef USE_ITHREADS
 # ifdef I_PTHREAD
@@ -1576,6 +1582,7 @@ fuse_version()
        OUTPUT:
        RETVAL
 
+#ifndef __FreeBSD__
 SV *
 XATTR_CREATE()
        CODE:
@@ -1590,6 +1597,8 @@ XATTR_REPLACE()
        OUTPUT:
        RETVAL
 
+#endif
+
 void
 perl_fuse_main(...)
        PREINIT:
@@ -1657,8 +1666,8 @@ perl_fuse_main(...)
                fuse_opt_free_args(&args);
                croak("out of memory\n");
        }
-       if (mountopts &&
-            fuse_opt_add_arg(&args, "-o") == -1 ||
+       if (mountopts && strcmp("", mountopts) &&
+            (fuse_opt_add_arg(&args, "-o") == -1 ||
             fuse_opt_add_arg(&args, mountopts) == -1)) {
                fuse_opt_free_args(&args);
                croak("out of memory\n");