summaryrefslogtreecommitdiff
path: root/lib/libc
diff options
context:
space:
mode:
authorEdwin Groothuis <edwin@FreeBSD.org>2009-10-31 06:35:40 +0000
committerEdwin Groothuis <edwin@FreeBSD.org>2009-10-31 06:35:40 +0000
commit05edd60be4d7d6ca84139790e90a061945904cd3 (patch)
treef95c83a65d0a6b89dda89b64c924856b92edaae8 /lib/libc
parente22a16d5d30126cdefa97f958dc00766d602b5d8 (diff)
Notes
Diffstat (limited to 'lib/libc')
-rw-r--r--lib/libc/locale/nl_langinfo.c6
-rw-r--r--lib/libc/stdtime/localtime.c11
2 files changed, 15 insertions, 2 deletions
diff --git a/lib/libc/locale/nl_langinfo.c b/lib/libc/locale/nl_langinfo.c
index 9bd508214e4b..26ca02544982 100644
--- a/lib/libc/locale/nl_langinfo.c
+++ b/lib/libc/locale/nl_langinfo.c
@@ -93,6 +93,12 @@ nl_langinfo(nl_item item)
case ABMON_9: case ABMON_10: case ABMON_11: case ABMON_12:
ret = (char*) __get_current_time_locale()->mon[_REL(ABMON_1)];
break;
+ case ALTMON_1: case ALTMON_2: case ALTMON_3: case ALTMON_4:
+ case ALTMON_5: case ALTMON_6: case ALTMON_7: case ALTMON_8:
+ case ALTMON_9: case ALTMON_10: case ALTMON_11: case ALTMON_12:
+ ret = (char*)
+ __get_current_time_locale()->alt_month[_REL(ALTMON_1)];
+ break;
case ERA:
/* XXX: need to be implemented */
ret = "";
diff --git a/lib/libc/stdtime/localtime.c b/lib/libc/stdtime/localtime.c
index e0ed73f7d96f..9fc5f3ee99b7 100644
--- a/lib/libc/stdtime/localtime.c
+++ b/lib/libc/stdtime/localtime.c
@@ -21,6 +21,7 @@ __FBSDID("$FreeBSD$");
#include "namespace.h"
#include <sys/types.h>
#include <sys/stat.h>
+#include <errno.h>
#include <fcntl.h>
#include <pthread.h>
#include "private.h"
@@ -1413,13 +1414,16 @@ const time_t * const timep;
static pthread_mutex_t localtime_mutex = PTHREAD_MUTEX_INITIALIZER;
static pthread_key_t localtime_key = -1;
struct tm *p_tm;
+ int r;
if (__isthreaded != 0) {
if (localtime_key < 0) {
_pthread_mutex_lock(&localtime_mutex);
if (localtime_key < 0) {
- if (_pthread_key_create(&localtime_key, free) < 0) {
+ if ((r = _pthread_key_create(&localtime_key,
+ free)) != 0) {
_pthread_mutex_unlock(&localtime_mutex);
+ errno = r;
return(NULL);
}
}
@@ -1512,13 +1516,16 @@ const time_t * const timep;
static pthread_mutex_t gmtime_mutex = PTHREAD_MUTEX_INITIALIZER;
static pthread_key_t gmtime_key = -1;
struct tm *p_tm;
+ int r;
if (__isthreaded != 0) {
if (gmtime_key < 0) {
_pthread_mutex_lock(&gmtime_mutex);
if (gmtime_key < 0) {
- if (_pthread_key_create(&gmtime_key, free) < 0) {
+ if ((r = _pthread_key_create(&gmtime_key,
+ free)) != 0) {
_pthread_mutex_unlock(&gmtime_mutex);
+ errno = r;
return(NULL);
}
}