aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLee Hanxue <hanxue.developer@gmail.com>2014-05-09 11:25:43 +0800
committerLee Hanxue <hanxue.developer@gmail.com>2014-05-09 11:35:38 +0800
commite130b9acd6d2a7d2aa389cc982717edfe9fb56aa (patch)
tree99c7888ec946b1c1c811f12ce96c2ea1bada7dda /src
parent799cef8d964f60470cdfd6c9f816d2383a1817fd (diff)
downloadbindfs-e130b9acd6d2a7d2aa389cc982717edfe9fb56aa.tar.gz
Remove fuse utimens dependency for OSX
Diffstat (limited to 'src')
-rw-r--r--src/bindfs.c18
-rw-r--r--src/misc.h1
2 files changed, 19 insertions, 0 deletions
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