summaryrefslogtreecommitdiffstats
path: root/lib/libc/locale/localeconv.c
diff options
context:
space:
mode:
authorache <ache@FreeBSD.org>2001-02-10 03:31:23 +0000
committerache <ache@FreeBSD.org>2001-02-10 03:31:23 +0000
commit3e4ec8e5b21f8d6fc42e74f11bd47efc7127e685 (patch)
treed5d50c4b5568efb0d45a609f8935f397982446e9 /lib/libc/locale/localeconv.c
parent42a3debfe346a42152afc07a0ea592e455948062 (diff)
downloadFreeBSD-src-3e4ec8e5b21f8d6fc42e74f11bd47efc7127e685.zip
FreeBSD-src-3e4ec8e5b21f8d6fc42e74f11bd47efc7127e685.tar.gz
According to Garrett, POSIX widely use -1 to indicate CHAR_MAX, so back out
all my "-1" -> "something" fixes and replace -1 with CHAR_MAX directly in strtol() in cnv()
Diffstat (limited to 'lib/libc/locale/localeconv.c')
-rw-r--r--lib/libc/locale/localeconv.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/libc/locale/localeconv.c b/lib/libc/locale/localeconv.c
index 6e62388..24ff28f 100644
--- a/lib/libc/locale/localeconv.c
+++ b/lib/libc/locale/localeconv.c
@@ -34,6 +34,7 @@ static char rcsid[] = "$FreeBSD$";
#include <locale.h>
#include <stdlib.h>
+#include <limits.h>
#include "lmonetary.h"
#include "lnumeric.h"
@@ -51,7 +52,10 @@ int __nlocale_changed = 1;
static char
cnv(char *str) {
- return (char)strtol(str, NULL, 0);
+ int i = strtol(str, NULL, 10);
+ if (i == -1)
+ i = CHAR_MAX;
+ return (char)i;
}
/*
OpenPOWER on IntegriCloud