diff options
-rw-r--r-- | compat/mingw.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/compat/mingw.c b/compat/mingw.c index fe609239dd..75695a24a3 100644 --- a/compat/mingw.c +++ b/compat/mingw.c @@ -986,16 +986,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) |