From 1276d521225d13681fc81814f9a562e6d7fc46e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Duval?= Date: Mon, 19 Apr 2010 17:12:44 +0000 Subject: [PATCH] * fixed utimensat() when times is NULL, both the access and modification timestamps should be set (bug #5759). * the meaning of AT_SYMLINK_NOFOLLOW was also reversed. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36356 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/system/libroot/posix/sys/utimes.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/system/libroot/posix/sys/utimes.c b/src/system/libroot/posix/sys/utimes.c index c9d6d430bf..e43976875b 100644 --- a/src/system/libroot/posix/sys/utimes.c +++ b/src/system/libroot/posix/sys/utimes.c @@ -54,6 +54,7 @@ utimensat(int fd, const char *path, const struct timespec times[2], int flag) bigtime_t now = real_time_clock_usecs(); stat.st_atim.tv_sec = stat.st_mtim.tv_sec = now / 1000000; stat.st_atim.tv_nsec = stat.st_mtim.tv_nsec = (now % 1000000) * 1000; + mask |= B_STAT_ACCESS_TIME | B_STAT_MODIFICATION_TIME; } if (times != NULL) { @@ -84,7 +85,7 @@ utimensat(int fd, const char *path, const struct timespec times[2], int flag) // set the times -- as per spec we even need to do this, if both have // UTIME_OMIT set - status = _kern_write_stat(fd, path, (flag & AT_SYMLINK_NOFOLLOW) != 0, + status = _kern_write_stat(fd, path, (flag & AT_SYMLINK_NOFOLLOW) == 0, &stat, sizeof(struct stat), mask); RETURN_AND_SET_ERRNO(status);