From 90b31eb333a6c0d64aa04fda4d2d94f79a5fdcdb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Fri, 15 Nov 2002 22:48:14 +0000 Subject: [PATCH] Before starting to implement a function, you should know what to do ;-) git-svn-id: file:///srv/svn/repos/haiku/trunk/current@1953 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/kernel/libroot/posix/utime.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/kernel/libroot/posix/utime.c b/src/kernel/libroot/posix/utime.c index f0ffcd74fe..1dff6aa1d5 100644 --- a/src/kernel/libroot/posix/utime.c +++ b/src/kernel/libroot/posix/utime.c @@ -5,6 +5,7 @@ #include +#include #include #include @@ -18,13 +19,17 @@ int -utime(const char *path, const struct utimbuf *buffer) +utime(const char *path, const struct utimbuf *times) { struct stat stat; status_t status; - stat.st_atime = buffer->actime; - stat.st_mtime = buffer->modtime; + if (times != NULL) { + stat.st_atime = times->actime; + stat.st_mtime = times->modtime; + } else + stat.st_atime = stat.st_mtime = time(NULL); + status = sys_write_path_stat(path, false, &stat, FS_WRITE_STAT_MTIME | FS_WRITE_STAT_ATIME); RETURN_AND_SET_ERRNO(status);