From 8287c0d3f0b0cbaa24a923e152fcf4ee3e8ecd2f Mon Sep 17 00:00:00 2001 From: Marc Andre Tanner Date: Thu, 10 Apr 2008 20:18:40 +0200 Subject: [PATCH] Implement utimens instead of utime as the latter is deprecated. --- ciopfs.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/ciopfs.c b/ciopfs.c index d24f237..2108fac 100644 --- a/ciopfs.c +++ b/ciopfs.c @@ -42,6 +42,7 @@ #include #include #include +#include #include #include #include @@ -667,11 +668,18 @@ static int ciopfs_ftruncate(const char *path, off_t size, struct fuse_file_info return 0; } -static int ciopfs_utime(const char *path, struct utimbuf *buf) +static int ciopfs_utimens(const char *path, const struct timespec ts[2]) { char *p = map_path(path); + struct timeval tv[2]; + + tv[0].tv_sec = ts[0].tv_sec; + tv[0].tv_usec = ts[0].tv_nsec / 1000; + tv[1].tv_sec = ts[1].tv_sec; + tv[1].tv_usec = ts[1].tv_nsec / 1000; + enter_user_context(); - int res = utime(p, buf); + int res = utimes(p, tv); leave_user_context(); free(p); if (res == -1) @@ -866,7 +874,7 @@ struct fuse_operations ciopfs_operations = { .chown = ciopfs_chown, .truncate = ciopfs_truncate, .ftruncate = ciopfs_ftruncate, - .utime = ciopfs_utime, + .utimens = ciopfs_utimens, .create = ciopfs_create, .open = ciopfs_open, .read = ciopfs_read, -- 2.11.4.GIT