summaryrefslogtreecommitdiff
path: root/compat/mingw.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2010-08-31 16:14:27 -0700
committerJunio C Hamano <gitster@pobox.com>2010-08-31 16:14:27 -0700
commite24058f57f4e76e38e20390c5927590f3cd48085 (patch)
treed8f9b7149447d6d1be6ea847b807d247d3356fd4 /compat/mingw.c
parentd8a94803842989582989fd5f5c3062c49134ad5b (diff)
parent7d7ff15b39abfa9e73b6475f189006a74dc26376 (diff)
downloadgit-e24058f57f4e76e38e20390c5927590f3cd48085.tar.gz
Merge branch 'sg/rerere-gc-old-still-used'
* sg/rerere-gc-old-still-used: rerere: fix overeager gc mingw_utime(): handle NULL times parameter
Diffstat (limited to 'compat/mingw.c')
-rw-r--r--compat/mingw.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/compat/mingw.c b/compat/mingw.c
index 96be8a02cf..f2d9e1fd97 100644
--- 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;