summaryrefslogtreecommitdiff
path: root/src/rofiles-fuse/main.c
diff options
context:
space:
mode:
authorAlexander Larsson <alexl@redhat.com>2017-11-28 15:23:39 +0100
committerAtomic Bot <atomic-devel@projectatomic.io>2017-11-28 14:45:10 +0000
commit6f1bf70a769204f0627a9d499ec9cf223947a325 (patch)
tree1c53aab0db6db5ad0833d357ca582b76243dc526 /src/rofiles-fuse/main.c
parent82e2150b98bd1ad5149c1e86db22f8ffb2dd6a41 (diff)
downloadostree-6f1bf70a769204f0627a9d499ec9cf223947a325.tar.gz
rofiles-fuse: Fix utime() support
We use utimens instead of utime, thus allowing nanosecond timestamps, and also fixes a bug where we used to passed UTIME_OMIT to tv_nsec which made the entire operation a no-op. Closes: #1351 Approved by: cgwalters
Diffstat (limited to 'src/rofiles-fuse/main.c')
-rw-r--r--src/rofiles-fuse/main.c13
1 files changed, 3 insertions, 10 deletions
diff --git a/src/rofiles-fuse/main.c b/src/rofiles-fuse/main.c
index 97c91b60..9e04274b 100644
--- a/src/rofiles-fuse/main.c
+++ b/src/rofiles-fuse/main.c
@@ -284,18 +284,11 @@ callback_truncate (const char *path, off_t size)
}
static int
-callback_utime (const char *path, struct utimbuf *buf)
+callback_utimens (const char *path, const struct timespec tv[2])
{
- struct timespec ts[2];
-
path = ENSURE_RELPATH (path);
- ts[0].tv_sec = buf->actime;
- ts[0].tv_nsec = UTIME_OMIT;
- ts[1].tv_sec = buf->modtime;
- ts[1].tv_nsec = UTIME_OMIT;
-
- if (utimensat (basefd, path, ts, AT_SYMLINK_NOFOLLOW) == -1)
+ if (utimensat (basefd, path, tv, AT_SYMLINK_NOFOLLOW) == -1)
return -errno;
return 0;
@@ -506,7 +499,7 @@ struct fuse_operations callback_oper = {
.chmod = callback_chmod,
.chown = callback_chown,
.truncate = callback_truncate,
- .utime = callback_utime,
+ .utimens = callback_utimens,
.create = callback_create,
.open = callback_open,
.read_buf = callback_read_buf,