Skip to content

Commit

Permalink
lklfuse: fix utimens mtime
Browse files Browse the repository at this point in the history
The utimens array layout is { atime, mtime } but in copying the values
from timespec to lkl_timespec, fuse source array offset 0 (atime) is
used for both lkl_timespec atime and mtime values.

Signed-off-by: David Disseldorp <[email protected]>
  • Loading branch information
ddiss committed May 30, 2024
1 parent 925c6f7 commit 3c57c31
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions tools/lkl/lklfuse.c
Original file line number Diff line number Diff line change
Expand Up @@ -444,12 +444,10 @@ static int lklfuse_access(const char *path, int mode)

static int lklfuse_utimens(const char *path, const struct timespec tv[2])
{
struct lkl_timespec ts[2];

ts[0].tv_sec = tv[0].tv_sec;
ts[0].tv_nsec = tv[0].tv_nsec;
ts[1].tv_sec = tv[0].tv_sec;
ts[1].tv_nsec = tv[0].tv_nsec;
struct lkl_timespec ts[2] = {
{ tv_sec: tv[0].tv_sec, tv_nsec: tv[0].tv_nsec },
{ tv_sec: tv[1].tv_sec, tv_nsec: tv[1].tv_nsec },
};

return lkl_sys_utimensat(-1, path, (struct __lkl__kernel_timespec *)ts,
LKL_AT_SYMLINK_NOFOLLOW);
Expand Down

0 comments on commit 3c57c31

Please sign in to comment.