From: psykose Date: Wed, 2 Mar 2022 20:16:54 +0000 (+0100) Subject: accept null pointer as message argument to gettext functions X-Git-Url: http://nsz.repo.hu/git/?a=commitdiff_plain;h=01b14242cccb03c411d3eb1437c99da663c95507;p=musl 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. --- 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();