aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--configure.ac2
-rw-r--r--src/bindfs.c18
-rw-r--r--src/misc.h1
-rw-r--r--tests/Makefile.am12
4 files changed, 30 insertions, 3 deletions
diff --git a/configure.ac b/configure.ac
index 0997c61..878b9ff 100644
--- a/configure.ac
+++ b/configure.ac
@@ -31,6 +31,8 @@ if test x"$with_core_foundation" == "xyes" ; then
LDFLAGS="${LDFLAGS} -framework CoreFoundation"
fi
+AM_CONDITIONAL(BUILD_OS_IS_DARWIN, [test x"$build_os" = darwin])
+
my_CPPFLAGS="-D_REENTRANT -D_FILE_OFFSET_BITS=64 -DFUSE_USE_VERSION=26"
my_CFLAGS="$my_CFLAGS -Wall"
my_LDFLAGS="-pthread"
diff --git a/src/bindfs.c b/src/bindfs.c
index 9348b2c..5f4b3c8 100644
--- a/src/bindfs.c
+++ b/src/bindfs.c
@@ -177,7 +177,11 @@ static int bindfs_chown(const char *path, uid_t uid, gid_t gid);
static int bindfs_truncate(const char *path, off_t size);
static int bindfs_ftruncate(const char *path, off_t size,
struct fuse_file_info *fi);
+#ifdef __APPLE__
+static int bindfs_utime(const char *path, struct utimbuf *buf);
+#else
static int bindfs_utimens(const char *path, const struct timespec tv[2]);
+#endif
static int bindfs_create(const char *path, mode_t mode, struct fuse_file_info *fi);
static int bindfs_open(const char *path, struct fuse_file_info *fi);
static int bindfs_read(const char *path, char *buf, size_t size, off_t offset,
@@ -690,13 +694,21 @@ static int bindfs_ftruncate(const char *path, off_t size,
return 0;
}
+#ifdef __APPLE__
+static int bindfs_utime(const char *path, struct utimbuf *buf)
+#else
static int bindfs_utimens(const char *path, const struct timespec tv[2])
+#endif
{
int res;
path = process_path(path);
+ #ifdef __APPLE__
+ res = utime(path, buf);
+ #else
res = utimensat(settings.mntsrc_fd, path, tv, AT_SYMLINK_NOFOLLOW);
+ #endif
if (res == -1)
return -errno;
@@ -906,7 +918,11 @@ static struct fuse_operations bindfs_oper = {
.chown = bindfs_chown,
.truncate = bindfs_truncate,
.ftruncate = bindfs_ftruncate,
+ #ifdef __APPLE__
+ .utime = bindfs_utime,
+ #else
.utimens = bindfs_utimens,
+ #endif
.create = bindfs_create,
.open = bindfs_open,
.read = bindfs_read,
@@ -1599,6 +1615,8 @@ int main(int argc, char *argv[])
fuse_main_return = fuse_main(args.argc, args.argv, &bindfs_oper, NULL);
+
+
fuse_opt_free_args(&args);
close(settings.mntsrc_fd);
diff --git a/src/misc.h b/src/misc.h
index 8b00f8d..f09883d 100644
--- a/src/misc.h
+++ b/src/misc.h
@@ -17,6 +17,7 @@
along with bindfs. If not, see <http://www.gnu.org/licenses/>.
*/
+
#ifndef INC_BINDFS_MISC_H
#define INC_BINDFS_MISC_H
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 8fc80ea..53a9081 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -1,7 +1,13 @@
-noinst_PROGRAMS = readdir_inode utimens_nofollow
-readdir_inode_SOURCES = readdir_inode.c
-utimens_nofollow_SOURCES = utimens_nofollow.c
+UNAME_S := $(shell uname -s)
+if BUILD_OS_IS_DARWIN
+ noinst_PROGRAMS = readdir_inode
+ readdir_inode_SOURCES = readdir_inode.c
+else
+ noinst_PROGRAMS = readdir_inode utimens_nofollow
+ readdir_inode_SOURCES = readdir_inode.c
+ utimens_nofollow_SOURCES = utimens_nofollow.c
+endif
TESTS = test_bindfs.rb
SUBDIRS = internals