summaryrefslogtreecommitdiffstats
path: root/lib/libc/stdtime/localtime.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/libc/stdtime/localtime.c')
-rw-r--r--lib/libc/stdtime/localtime.c14
1 files changed, 6 insertions, 8 deletions
diff --git a/lib/libc/stdtime/localtime.c b/lib/libc/stdtime/localtime.c
index 83cecd1..e0ed73f 100644
--- a/lib/libc/stdtime/localtime.c
+++ b/lib/libc/stdtime/localtime.c
@@ -1472,18 +1472,16 @@ struct tm * const tmp;
{
register struct tm * result;
+ _MUTEX_LOCK(&gmt_mutex);
if (!gmt_is_set) {
- _MUTEX_LOCK(&gmt_mutex);
- if (!gmt_is_set) {
#ifdef ALL_STATE
- gmtptr = (struct state *) malloc(sizeof *gmtptr);
- if (gmtptr != NULL)
+ gmtptr = (struct state *) malloc(sizeof *gmtptr);
+ if (gmtptr != NULL)
#endif /* defined ALL_STATE */
- gmtload(gmtptr);
- gmt_is_set = TRUE;
- }
- _MUTEX_UNLOCK(&gmt_mutex);
+ gmtload(gmtptr);
+ gmt_is_set = TRUE;
}
+ _MUTEX_UNLOCK(&gmt_mutex);
result = timesub(timep, offset, gmtptr, tmp);
#ifdef TM_ZONE
/*
OpenPOWER on IntegriCloud