Commit b34454d0 authored by Eli Zaretskii's avatar Eli Zaretskii

Fix bug #15176 with setting directory times on MS-Windows.

 src/w32.c (fdutimens): Call 'utime', which is implemented on w32.c
 to handle directories, rather than '_utime' which doesn't.
parent 6e1b469e
2013-08-24 Eli Zaretskii <eliz@gnu.org>
* w32.c (fdutimens): Call 'utime', which is implemented on w32.c
to handle directories, rather than '_utime' which doesn't.
(Bug#15176)
2013-08-24 Jan Djärv <jan.h.d@swipnet.se>
* gtkutil.c (x_wm_set_size_hint): Don't set hints when maximized
......
......@@ -2503,8 +2503,6 @@ gettimeofday (struct timeval *__restrict tv, struct timezone *__restrict tz)
int
fdutimens (int fd, char const *file, struct timespec const timespec[2])
{
struct _utimbuf ut;
if (!timespec)
{
errno = ENOSYS;
......@@ -2515,12 +2513,28 @@ fdutimens (int fd, char const *file, struct timespec const timespec[2])
errno = EBADF;
return -1;
}
ut.actime = timespec[0].tv_sec;
ut.modtime = timespec[1].tv_sec;
/* _futime's prototype defines 2nd arg as having the type 'struct
_utimbuf', while utime needs to accept 'struct utimbuf' for
compatibility with Posix. So we need to use 2 different (but
equivalent) types to avoid compiler warnings, sigh. */
if (fd >= 0)
return _futime (fd, &ut);
{
struct _utimbuf _ut;
_ut.actime = timespec[0].tv_sec;
_ut.modtime = timespec[1].tv_sec;
return _futime (fd, &_ut);
}
else
return _utime (file, &ut);
{
struct utimbuf ut;
ut.actime = timespec[0].tv_sec;
ut.modtime = timespec[1].tv_sec;
/* Call 'utime', which is implemented below, not the MS library
function, which fails on directories. */
return utime (file, &ut);
}
}
......@@ -4501,6 +4515,9 @@ fstat (int desc, struct stat * buf)
return 0;
}
/* A version of 'utime' which handles directories as well as
files. */
int
utime (const char *name, struct utimbuf *times)
{
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment