Browse Source

localtime_r: don't set errno on success

pull/141/head
Steve Lhomme 3 years ago
parent
commit
571cda1958
  1. 6
      compat/localtime_r.c

6
compat/localtime_r.c

@ -37,7 +37,11 @@ struct tm *localtime_r (const time_t *timep, struct tm *result)
#if (__STDC_WANT_LIB_EXT1__)
return localtime_s(timep, result);
#elif defined (_WIN32)
return ((errno = localtime_s(result, timep)) == 0) ? result : NULL;
errno_t ret = localtime_s(result, timep);
if (ret == 0)
return result;
errno = ret;
return NULL;
#else
# warning localtime_r() not implemented!
return gmtime_r(timep, result);

Loading…
Cancel
Save