aboutsummaryrefslogtreecommitdiffstats
path: root/src/w32.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/w32.c')
-rw-r--r--src/w32.c29
1 files changed, 23 insertions, 6 deletions
diff --git a/src/w32.c b/src/w32.c
index 21dbf49ed7c..7f9b96a77a5 100644
--- a/src/w32.c
+++ b/src/w32.c
@@ -2503,8 +2503,6 @@ gettimeofday (struct timeval *__restrict tv, struct timezone *__restrict tz)
2503int 2503int
2504fdutimens (int fd, char const *file, struct timespec const timespec[2]) 2504fdutimens (int fd, char const *file, struct timespec const timespec[2])
2505{ 2505{
2506 struct _utimbuf ut;
2507
2508 if (!timespec) 2506 if (!timespec)
2509 { 2507 {
2510 errno = ENOSYS; 2508 errno = ENOSYS;
@@ -2515,12 +2513,28 @@ fdutimens (int fd, char const *file, struct timespec const timespec[2])
2515 errno = EBADF; 2513 errno = EBADF;
2516 return -1; 2514 return -1;
2517 } 2515 }
2518 ut.actime = timespec[0].tv_sec; 2516 /* _futime's prototype defines 2nd arg as having the type 'struct
2519 ut.modtime = timespec[1].tv_sec; 2517 _utimbuf', while utime needs to accept 'struct utimbuf' for
2518 compatibility with Posix. So we need to use 2 different (but
2519 equivalent) types to avoid compiler warnings, sigh. */
2520 if (fd >= 0) 2520 if (fd >= 0)
2521 return _futime (fd, &ut); 2521 {
2522 struct _utimbuf _ut;
2523
2524 _ut.actime = timespec[0].tv_sec;
2525 _ut.modtime = timespec[1].tv_sec;
2526 return _futime (fd, &_ut);
2527 }
2522 else 2528 else
2523 return _utime (file, &ut); 2529 {
2530 struct utimbuf ut;
2531
2532 ut.actime = timespec[0].tv_sec;
2533 ut.modtime = timespec[1].tv_sec;
2534 /* Call 'utime', which is implemented below, not the MS library
2535 function, which fails on directories. */
2536 return utime (file, &ut);
2537 }
2524} 2538}
2525 2539
2526 2540
@@ -4501,6 +4515,9 @@ fstat (int desc, struct stat * buf)
4501 return 0; 4515 return 0;
4502} 4516}
4503 4517
4518/* A version of 'utime' which handles directories as well as
4519 files. */
4520
4504int 4521int
4505utime (const char *name, struct utimbuf *times) 4522utime (const char *name, struct utimbuf *times)
4506{ 4523{