Skip to content

Commit 28ec316

Browse files
committed
libpq code should use libpq_gettext(), not _()
Fix some wrong use and install a safeguard against future mistakes.
1 parent 66af5ee commit 28ec316

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

src/interfaces/libpq/fe-auth-scram.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -922,7 +922,7 @@ pg_fe_scram_build_secret(const char *password, const char **errstr)
922922
rc = pg_saslprep(password, &prep_password);
923923
if (rc == SASLPREP_OOM)
924924
{
925-
*errstr = _("out of memory");
925+
*errstr = libpq_gettext("out of memory");
926926
return NULL;
927927
}
928928
if (rc == SASLPREP_SUCCESS)
@@ -931,7 +931,7 @@ pg_fe_scram_build_secret(const char *password, const char **errstr)
931931
/* Generate a random salt */
932932
if (!pg_strong_random(saltbuf, SCRAM_DEFAULT_SALT_LEN))
933933
{
934-
*errstr = _("could not generate random salt");
934+
*errstr = libpq_gettext("could not generate random salt");
935935
free(prep_password);
936936
return NULL;
937937
}

src/interfaces/libpq/libpq-int.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -881,6 +881,11 @@ extern char *libpq_ngettext(const char *msgid, const char *msgid_plural, unsigne
881881
#define libpq_gettext(x) (x)
882882
#define libpq_ngettext(s, p, n) ((n) == 1 ? (s) : (p))
883883
#endif
884+
/*
885+
* libpq code should use the above, not _(), since that would use the
886+
* surrounding programs's message catalog.
887+
*/
888+
#undef _
884889

885890
/*
886891
* These macros are needed to let error-handling code be portable between

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy