From 315009a4836e684d61072683f84730a223892561 Mon Sep 17 00:00:00 2001 From: "Andrey A. Chernov" Date: Wed, 7 Aug 2002 23:52:28 +0000 Subject: [PATCH] Set errno to ENOMEM for strdup too (due to malloc errno bug) --- lib/libc/nls/msgcat.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/libc/nls/msgcat.c b/lib/libc/nls/msgcat.c index 122cb9c5e1fb..408e198e8a33 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); }