summaryrefslogtreecommitdiff
path: root/compat/mingw.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2019-12-16 21:08:31 (GMT)
committerJunio C Hamano <gitster@pobox.com>2019-12-16 21:08:31 (GMT)
commit4755a34c47c6d624d77ce90c7ea5247b43829cc0 (patch)
tree3ad415411bd7dfed02ce8ab0b645e0c043c08a19 /compat/mingw.c
parent37c2619d91aa63d4c7c07b6f8de5ff2e1c2472b2 (diff)
parent0109d676f9d4d6f9d149d5194bdb200c6de3fcca (diff)
downloadgit-4755a34c47c6d624d77ce90c7ea5247b43829cc0.zip
git-4755a34c47c6d624d77ce90c7ea5247b43829cc0.tar.gz
git-4755a34c47c6d624d77ce90c7ea5247b43829cc0.tar.bz2
Merge branch 'dd/time-reentrancy'
Avoid gmtime() and localtime() and prefer their reentrant counterparts. * dd/time-reentrancy: mingw: use {gm,local}time_s as backend for {gm,local}time_r archive-zip.c: switch to reentrant localtime_r date.c: switch to reentrant {gm,local}time_r
Diffstat (limited to 'compat/mingw.c')
-rw-r--r--compat/mingw.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/compat/mingw.c b/compat/mingw.c
index c2a4835..76ac871 100644
--- a/compat/mingw.c
+++ b/compat/mingw.c
@@ -1018,16 +1018,16 @@ int pipe(int filedes[2])
struct tm *gmtime_r(const time_t *timep, struct tm *result)
{
- /* gmtime() in MSVCRT.DLL is thread-safe, but not reentrant */
- memcpy(result, gmtime(timep), sizeof(struct tm));
- return result;
+ if (gmtime_s(result, timep) == 0)
+ return result;
+ return NULL;
}
struct tm *localtime_r(const time_t *timep, struct tm *result)
{
- /* localtime() in MSVCRT.DLL is thread-safe, but not reentrant */
- memcpy(result, localtime(timep), sizeof(struct tm));
- return result;
+ if (localtime_s(result, timep) == 0)
+ return result;
+ return NULL;
}
char *mingw_getcwd(char *pointer, int len)