[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] trunk r113989: Fix bug #15176 with setting directory times
From: |
Eli Zaretskii |
Subject: |
[Emacs-diffs] trunk r113989: Fix bug #15176 with setting directory times on MS-Windows. |
Date: |
Sat, 24 Aug 2013 10:15:39 +0000 |
User-agent: |
Bazaar (2.6b2) |
------------------------------------------------------------
revno: 113989
revision-id: address@hidden
parent: address@hidden
fixes bug: http://debbugs.gnu.org/15176
committer: Eli Zaretskii <address@hidden>
branch nick: trunk
timestamp: Sat 2013-08-24 13:15:01 +0300
message:
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.
modified:
src/ChangeLog changelog-20091113204419-o5vbwnq5f7feedwu-1438
src/w32.c w32.c-20091113204419-o5vbwnq5f7feedwu-808
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog 2013-08-24 08:43:36 +0000
+++ b/src/ChangeLog 2013-08-24 10:15:01 +0000
@@ -1,3 +1,9 @@
+2013-08-24 Eli Zaretskii <address@hidden>
+
+ * 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 <address@hidden>
* gtkutil.c (x_wm_set_size_hint): Don't set hints when maximized
=== modified file 'src/w32.c'
--- a/src/w32.c 2013-08-09 12:25:34 +0000
+++ b/src/w32.c 2013-08-24 10:15:01 +0000
@@ -2503,8 +2503,6 @@
int
fdutimens (int fd, char const *file, struct timespec const timespec[2])
{
- struct _utimbuf ut;
-
if (!timespec)
{
errno = ENOSYS;
@@ -2515,12 +2513,28 @@
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 @@
return 0;
}
+/* A version of 'utime' which handles directories as well as
+ files. */
+
int
utime (const char *name, struct utimbuf *times)
{
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] trunk r113989: Fix bug #15176 with setting directory times on MS-Windows.,
Eli Zaretskii <=