Andrew's git
/
gitweb.git
/ diff
summary
|
log
|
commit
| diff |
tree
commit
grep
author
committer
pickaxe
?
re
mingw_utime(): handle NULL times parameter
author
SZEDER Gábor
<szeder@ira.uka.de>
Mon, 12 Jul 2010 23:42:03 +0000
(
01:42
+0200)
committer
Junio C Hamano
<gitster@pobox.com>
Tue, 13 Jul 2010 00:34:46 +0000
(17:34 -0700)
POSIX sayeth:
"If times is a null pointer, the access and modification
times of the file shall be set to the current time."
Let's do so.
Signed-off-by: SZEDER Gábor <szeder@ira.uka.de>
Signed-off-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
compat/mingw.c
patch
|
blob
|
history
raw
|
patch
| inline |
side by side
(parent:
a146392
)
diff --git
a/compat/mingw.c
b/compat/mingw.c
index 9a8e3365827d303c6513475726113a3952fe0040..24333cb167f785cbcf29775eec1237259221e89c 100644
(file)
--- a/
compat/mingw.c
+++ b/
compat/mingw.c
@@
-304,8
+304,13
@@
int mingw_utime (const char *file_name, const struct utimbuf *times)
goto revert_attrs;
}
- time_t_to_filetime(times->modtime, &mft);
- time_t_to_filetime(times->actime, &aft);
+ if (times) {
+ time_t_to_filetime(times->modtime, &mft);
+ time_t_to_filetime(times->actime, &aft);
+ } else {
+ GetSystemTimeAsFileTime(&mft);
+ aft = mft;
+ }
if (!SetFileTime((HANDLE)_get_osfhandle(fh), NULL, &aft, &mft)) {
errno = EINVAL;
rc = -1;