musl - musl - an implementation of the standard library for Linux-based systems

index : musl
musl - an implementation of the standard library for Linux-based systems
summary refs log tree commit diff
diff options
context:
space:
mode:
authorpsykose <alice@ayaya.dev>2022年03月02日 21:16:54 +0100
committerRich Felker <dalias@aerifal.cx>2022年03月27日 18:59:15 -0400
commit01b14242cccb03c411d3eb1437c99da663c95507 (patch)
treeebbb655ab5fbeaee73b1f1dfef36da08a9cc14ff
parent6d8a515796270eb6cec8a278cb353a078a10f09a (diff)
downloadmusl-01b14242cccb03c411d3eb1437c99da663c95507.tar.gz
accept null pointer as message argument to gettext functions
the change to support passing null was rejected in the past on the grounds that GNU gettext documented it as undefined, on an assumption that only glibc accepted it and that the standalone GNU gettext did not. but it turned out that both explicitly accept it. in light of this, since some software assumes null can be passed safely, allow it.
Diffstat
-rw-r--r--src/locale/dcngettext.c 3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/locale/dcngettext.c b/src/locale/dcngettext.c
index d1e6c6d1..0b53286d 100644
--- a/src/locale/dcngettext.c
+++ b/src/locale/dcngettext.c
@@ -132,6 +132,9 @@ char *dcngettext(const char *domainname, const char *msgid1, const char *msgid2,
struct binding *q;
int old_errno = errno;
+ /* match gnu gettext behaviour */
+ if (!msgid1) goto notrans;
+
if ((unsigned)category >= LC_ALL) goto notrans;
if (!domainname) domainname = __gettextdomain();
generated by cgit v1.2.1 (git 2.18.0) at 2025年10月04日 20:17:48 +0000

AltStyle によって変換されたページ (->オリジナル) /