diff options
Diffstat (limited to 'winsup/cygwin/times.cc')
-rw-r--r-- | winsup/cygwin/times.cc | 36 |
1 files changed, 32 insertions, 4 deletions
diff --git a/winsup/cygwin/times.cc b/winsup/cygwin/times.cc index e4bcb8cef..1c28c51e3 100644 --- a/winsup/cygwin/times.cc +++ b/winsup/cygwin/times.cc @@ -441,12 +441,11 @@ gmtime (const time_t *tim_p) #endif /* POSIX_LOCALTIME */ -/* utimes: POSIX/SUSv3 */ -extern "C" int -utimes (const char *path, const struct timeval *tvp) +static int +utimes_worker (const char *path, const struct timeval *tvp, int nofollow) { int res = -1; - path_conv win32 (path, PC_SYM_FOLLOW); + path_conv win32 (path, nofollow ? PC_SYM_NOFOLLOW : PC_SYM_FOLLOW); fhandler_base *fh = NULL; bool fromfd = false; @@ -482,6 +481,35 @@ error: return res; } +/* utimes: POSIX/SUSv3 */ +extern "C" int +utimes (const char *path, const struct timeval *tvp) +{ + return utimes_worker (path, tvp, 0); +} + +/* BSD */ +extern "C" int +lutimes (const char *path, const struct timeval *tvp) +{ + return utimes_worker (path, tvp, 1); +} + +/* BSD */ +extern "C" int +futimes (int fd, const struct timeval *tvp) +{ + int res; + + cygheap_fdget cfd (fd); + if (cfd < 0) + res = -1; + else + res = cfd->utimes (tvp); + syscall_printf ("%d = futimes (%d, %p)", res, fd, tvp); + return res; +} + /* utime: POSIX 5.6.6.1 */ extern "C" int utime (const char *path, const struct utimbuf *buf) |