From 40a47ede7280c023495be97d54b08d60a932f4a7 Mon Sep 17 00:00:00 2001 From: Emmanuel Dreyfus Date: Thu, 8 Dec 2011 10:55:27 +0000 Subject: utimens availability check fusexmp uses utimens and takes that function for granted. It is part of POSIX exended API set 2 and some systems do not have it yet. Attached patch checks for utimens availability and returns ENOSYS if unavailable. --- example/fusexmp.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'example/fusexmp.c') diff --git a/example/fusexmp.c b/example/fusexmp.c index 58b77a8..fa3fb4d 100644 --- a/example/fusexmp.c +++ b/example/fusexmp.c @@ -213,16 +213,19 @@ static int xmp_truncate(const char *path, off_t size) return 0; } +#ifdef HAVE_UTIMENSAT static int xmp_utimens(const char *path, const struct timespec ts[2]) { int res; + /* don't use utime/utimes since they follow symlinks */ res = utimensat(0, path, ts, AT_SYMLINK_NOFOLLOW); if (res == -1) return -errno; return 0; } +#endif static int xmp_open(const char *path, struct fuse_file_info *fi) { @@ -359,7 +362,9 @@ static struct fuse_operations xmp_oper = { .chmod = xmp_chmod, .chown = xmp_chown, .truncate = xmp_truncate, +#ifdef HAVE_UTIMENSAT .utimens = xmp_utimens, +#endif .open = xmp_open, .read = xmp_read, .write = xmp_write, -- cgit v1.2.3