summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorache <ache@FreeBSD.org>2002-08-07 23:52:28 +0000
committerache <ache@FreeBSD.org>2002-08-07 23:52:28 +0000
commit586a522666b49914c4ff437eeea75730cbeefec1 (patch)
tree7a475034fe931a831a6b62fcab8cd9ea8a24b71e /lib
parent50ff7d43747a1dd2374b40b3ceb1fa3b7d3299cd (diff)
downloadFreeBSD-src-586a522666b49914c4ff437eeea75730cbeefec1.zip
FreeBSD-src-586a522666b49914c4ff437eeea75730cbeefec1.tar.gz
Set errno to ENOMEM for strdup too (due to malloc errno bug)
Diffstat (limited to 'lib')
-rw-r--r--lib/libc/nls/msgcat.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/libc/nls/msgcat.c b/lib/libc/nls/msgcat.c
index 122cb9c..408e198 100644
--- a/lib/libc/nls/msgcat.c
+++ b/lib/libc/nls/msgcat.c
@@ -96,8 +96,10 @@ catopen(name, type)
strchr(lang, '/') != NULL)
lang = "C";
- if ((plang = cptr1 = strdup(lang)) == NULL)
+ if ((plang = cptr1 = strdup(lang)) == NULL) {
+ errno = ENOMEM;
return (NLERR);
+ }
if ((cptr = strchr(cptr1, '@')) != NULL)
*cptr = '\0';
pter = pcode = "";
@@ -118,9 +120,8 @@ catopen(name, type)
nlspath = _DEFAULT_NLS_PATH;
if ((base = cptr = strdup(nlspath)) == NULL) {
- saverr = errno;
free(plang);
- errno = saverr;
+ errno = ENOMEM;
return (NLERR);
}
OpenPOWER on IntegriCloud