diff options
author | A. Wilcox <AWilcox@Wilcox-Tech.com> | 2019-01-28 03:27:29 +0000 |
---|---|---|
committer | A. Wilcox <AWilcox@Wilcox-Tech.com> | 2019-01-28 03:27:29 +0000 |
commit | 8df5b9cdd3494b1992f1411a9f5c8ad273814b91 (patch) | |
tree | 9b8dc8e4d7b25162f60030cfaf23cff7a54221e6 /system/musl/gettext-preserve-errno.patch | |
parent | 9d795b9a48d89b0a6f12d19d17d1cbe95e132b4e (diff) | |
download | packages-8df5b9cdd3494b1992f1411a9f5c8ad273814b91.tar.gz packages-8df5b9cdd3494b1992f1411a9f5c8ad273814b91.tar.bz2 packages-8df5b9cdd3494b1992f1411a9f5c8ad273814b91.tar.xz packages-8df5b9cdd3494b1992f1411a9f5c8ad273814b91.zip |
system/musl: ensure dcngettext() preserves errno
Diffstat (limited to 'system/musl/gettext-preserve-errno.patch')
-rw-r--r-- | system/musl/gettext-preserve-errno.patch | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/system/musl/gettext-preserve-errno.patch b/system/musl/gettext-preserve-errno.patch new file mode 100644 index 000000000..c55df3e21 --- /dev/null +++ b/system/musl/gettext-preserve-errno.patch @@ -0,0 +1,28 @@ +diff --git a/src/locale/dcngettext.c b/src/locale/dcngettext.c +index 8b891d00..4c304393 100644 +--- a/src/locale/dcngettext.c ++++ b/src/locale/dcngettext.c +@@ -122,6 +122,7 @@ char *dcngettext(const char *domainname, const char *msgid1, const char *msgid2, + const struct __locale_map *lm; + size_t domlen; + struct binding *q; ++ int old_errno = errno; + + if ((unsigned)category >= LC_ALL) goto notrans; + +@@ -138,6 +139,7 @@ char *dcngettext(const char *domainname, const char *msgid1, const char *msgid2, + lm = loc->cat[category]; + if (!lm) { + notrans: ++ errno = old_errno; + return (char *) ((n == 1) ? msgid1 : msgid2); + } + +@@ -250,6 +252,7 @@ notrans: + trans += l+1; + } + } ++ errno = old_errno; + return (char *)trans; + } + |