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
This commit is contained in:
Axel Dörfler
2002-11-15 22:48:14 +00:00
parent 0dd93a6eb7
commit 90b31eb333
+8 -3
View File
@@ -5,6 +5,7 @@
#include <utime.h> #include <utime.h>
#include <time.h>
#include <errno.h> #include <errno.h>
#include <syscalls.h> #include <syscalls.h>
@@ -18,13 +19,17 @@
int int
utime(const char *path, const struct utimbuf *buffer) utime(const char *path, const struct utimbuf *times)
{ {
struct stat stat; struct stat stat;
status_t status; status_t status;
stat.st_atime = buffer->actime; if (times != NULL) {
stat.st_mtime = buffer->modtime; 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); status = sys_write_path_stat(path, false, &stat, FS_WRITE_STAT_MTIME | FS_WRITE_STAT_ATIME);
RETURN_AND_SET_ERRNO(status); RETURN_AND_SET_ERRNO(status);