From: SZEDER Gábor Date: Mon, 12 Jul 2010 23:42:03 +0000 (+0200) Subject: mingw_utime(): handle NULL times parameter X-Git-Tag: v1.7.2.3~4^2~1 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=ded2d47668c8e865465a7ad69665696f9b56f24b;p=git.git mingw_utime(): handle NULL times parameter 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 Signed-off-by: Johannes Sixt Signed-off-by: Junio C Hamano --- diff --git a/compat/mingw.c b/compat/mingw.c index 9a8e33658..24333cb16 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;