diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/libc/locale/euc.c | 2 | ||||
-rw-r--r-- | lib/libc/locale/rune.c | 4 | ||||
-rw-r--r-- | lib/libc/locale/setrunelocale.c | 6 |
3 files changed, 5 insertions, 7 deletions
diff --git a/lib/libc/locale/euc.c b/lib/libc/locale/euc.c index 43194fa..596d107a 100644 --- a/lib/libc/locale/euc.c +++ b/lib/libc/locale/euc.c @@ -78,7 +78,7 @@ _EUC_init(rl) ++v; if ((ei = malloc(sizeof(_EucInfo))) == NULL) - return (ENOMEM); + return (errno == 0 ? ENOMEM : errno); new__mb_cur_max = 0; for (x = 0; x < 4; ++x) { diff --git a/lib/libc/locale/rune.c b/lib/libc/locale/rune.c index 63a50de..1783cba 100644 --- a/lib/libc/locale/rune.c +++ b/lib/libc/locale/rune.c @@ -70,10 +70,8 @@ _Read_RuneMagi(fp) return (NULL); } - if ((data = malloc(sb.st_size)) == NULL) { - errno = ENOMEM; + if ((data = malloc(sb.st_size)) == NULL) return (NULL); - } errno = 0; rewind(fp); /* Someone might have read the magic number once already */ diff --git a/lib/libc/locale/setrunelocale.c b/lib/libc/locale/setrunelocale.c index f1a01fc..042a06c 100644 --- a/lib/libc/locale/setrunelocale.c +++ b/lib/libc/locale/setrunelocale.c @@ -106,7 +106,7 @@ setrunelocale(char *encoding) return (ENAMETOOLONG); _PathLocale = strdup(p); if (_PathLocale == NULL) - return (ENOMEM); + return (errno == 0 ? ENOMEM : errno); } else _PathLocale = _PATH_LOCALE; } @@ -117,10 +117,10 @@ setrunelocale(char *encoding) (void) strcat(name, "/LC_CTYPE"); if ((fp = fopen(name, "r")) == NULL) - return (errno); + return (errno == 0 ? ENOENT : errno); if ((rl = _Read_RuneMagi(fp)) == NULL) { - saverr = errno; + saverr = (errno == 0 ? EFTYPE : errno); (void)fclose(fp); return (saverr); } |