diff options
Diffstat (limited to 'lib/libc/stdtime/localtime.c')
-rw-r--r-- | lib/libc/stdtime/localtime.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/lib/libc/stdtime/localtime.c b/lib/libc/stdtime/localtime.c index 5fe9f98..3438cc6 100644 --- a/lib/libc/stdtime/localtime.c +++ b/lib/libc/stdtime/localtime.c @@ -1109,12 +1109,10 @@ const time_t * const timep; } } pthread_mutex_unlock(&localtime_mutex); - if ((p_tm = pthread_getspecific(localtime_key)) != 0) { - return(NULL); - } else if (p_tm == NULL) { - if ((p_tm = (struct tm *)malloc(sizeof(struct tm))) == NULL) { + p_tm = pthread_getspecific(localtime_key); + if (p_tm == NULL) { + if ((p_tm = (struct tm *)malloc(sizeof(struct tm))) == NULL) return(NULL); - } pthread_setspecific(localtime_key, p_tm); } pthread_mutex_lock(&lcl_mutex); |