Preserve errno in fallback code
This commit is contained in:
parent
ea779ff36c
commit
5740f28044
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=101269
@ -239,6 +239,7 @@ loadlocale(category)
|
||||
char *ret;
|
||||
char *new = new_categories[category];
|
||||
char *old = current_categories[category];
|
||||
int saverr;
|
||||
|
||||
if ((new[0] == '.' &&
|
||||
(new[1] == '\0' || (new[1] == '.' && new[2] == '\0'))) ||
|
||||
@ -273,8 +274,10 @@ loadlocale(category)
|
||||
return (old); \
|
||||
ret = FUNC(new) != 0 ? NULL : new; \
|
||||
if (ret == NULL) { \
|
||||
saverr = errno; \
|
||||
if (FUNC(old) != 0 && FUNC("C") == 0) \
|
||||
(void)strcpy(old, "C"); \
|
||||
errno = saverr; \
|
||||
} else \
|
||||
(void)strcpy(old, new); \
|
||||
return (ret); \
|
||||
|
Loading…
Reference in New Issue
Block a user