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 <szeder@ira.uka.de> Signed-off-by: Johannes Sixt <j6t@kdbg.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
parent
a146392056
commit
ded2d47668
@ -304,8 +304,13 @@ int mingw_utime (const char *file_name, const struct utimbuf *times)
|
|||||||
goto revert_attrs;
|
goto revert_attrs;
|
||||||
}
|
}
|
||||||
|
|
||||||
time_t_to_filetime(times->modtime, &mft);
|
if (times) {
|
||||||
time_t_to_filetime(times->actime, &aft);
|
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)) {
|
if (!SetFileTime((HANDLE)_get_osfhandle(fh), NULL, &aft, &mft)) {
|
||||||
errno = EINVAL;
|
errno = EINVAL;
|
||||||
rc = -1;
|
rc = -1;
|
||||||
|
Loading…
Reference in New Issue
Block a user