diff options
author | Emmanuel Dreyfus <manu@netbsd.org> | 2011-12-08 10:55:27 +0000 |
---|---|---|
committer | Miklos Szeredi <mszeredi@suse.cz> | 2011-12-08 13:44:19 +0100 |
commit | 40a47ede7280c023495be97d54b08d60a932f4a7 (patch) | |
tree | 56cf6ec4e40db67b43b479ec4dc52636c8c8e4c0 | |
parent | 1bf98cf7bcefc810775e1aa80991a13e6070090c (diff) | |
download | android_external_fuse-40a47ede7280c023495be97d54b08d60a932f4a7.tar.gz android_external_fuse-40a47ede7280c023495be97d54b08d60a932f4a7.tar.bz2 android_external_fuse-40a47ede7280c023495be97d54b08d60a932f4a7.zip |
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.
-rw-r--r-- | ChangeLog | 3 | ||||
-rw-r--r-- | configure.in | 2 | ||||
-rw-r--r-- | example/fusexmp.c | 5 | ||||
-rw-r--r-- | example/fusexmp_fh.c | 5 |
4 files changed, 14 insertions, 1 deletions
@@ -3,6 +3,9 @@ * Fix build if FUSE_NODE_SLAB is not defined. Patch by Emmanuel Dreyfus + * Check for availability of utimensat() function. Patch by + Emmanuel Dreyfus + 2011-12-07 Miklos Szeredi <miklos@szeredi.hu> * Add fuse_lowlevel_notify_delete() which tells the kernel that a diff --git a/configure.in b/configure.in index aab304b..1d7dd5c 100644 --- a/configure.in +++ b/configure.in @@ -56,7 +56,7 @@ if test "$enable_mtab" = "no"; then AC_DEFINE(IGNORE_MTAB, 1, [Don't update /etc/mtab]) fi -AC_CHECK_FUNCS([fork setxattr fdatasync splice vmsplice]) +AC_CHECK_FUNCS([fork setxattr fdatasync splice vmsplice utimensat]) AC_CHECK_MEMBERS([struct stat.st_atim]) AC_CHECK_MEMBERS([struct stat.st_atimespec]) 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, diff --git a/example/fusexmp_fh.c b/example/fusexmp_fh.c index 046185c..57053ca 100644 --- a/example/fusexmp_fh.c +++ b/example/fusexmp_fh.c @@ -283,16 +283,19 @@ static int xmp_ftruncate(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_create(const char *path, mode_t mode, struct fuse_file_info *fi) { @@ -513,7 +516,9 @@ static struct fuse_operations xmp_oper = { .chown = xmp_chown, .truncate = xmp_truncate, .ftruncate = xmp_ftruncate, +#ifdef HAVE_UTIMENSAT .utimens = xmp_utimens, +#endif .create = xmp_create, .open = xmp_open, .read = xmp_read, |