diff options
Diffstat (limited to 'lib/libc')
-rw-r--r-- | lib/libc/gen/ttyname.c | 2 | ||||
-rw-r--r-- | lib/libc/stdtime/localtime.c | 8 |
2 files changed, 4 insertions, 6 deletions
diff --git a/lib/libc/gen/ttyname.c b/lib/libc/gen/ttyname.c index 3c87d69..b2f3f79 100644 --- a/lib/libc/gen/ttyname.c +++ b/lib/libc/gen/ttyname.c @@ -117,7 +117,7 @@ __ttyname_basic(int fd) pthread_mutex_lock(&ttyname_lock); if (ttyname_init == 0) { - if (pthread_keycreate(&ttyname_key, free)) { + if (pthread_key_create(&ttyname_key, free)) { pthread_mutex_unlock(&ttyname_lock); return (NULL); } 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); |