Skip to content

Commit d7013b0

Browse files
committed
On WIN32, don't choke when setlocale(LC_MESSAGES, "") returns NULL.
Per report from Magnus.
1 parent 16974ee commit d7013b0

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

src/backend/utils/adt/pg_locale.c

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
*
55
* Portions Copyright (c) 2002-2003, PostgreSQL Global Development Group
66
*
7-
* $PostgreSQL: pgsql/src/backend/utils/adt/pg_locale.c,v 1.25 2004/01/19 19:04:40 tgl Exp $
7+
* $PostgreSQL: pgsql/src/backend/utils/adt/pg_locale.c,v 1.26 2004/05/27 19:19:05 tgl Exp $
88
*
99
*-----------------------------------------------------------------------
1010
*/
@@ -131,11 +131,22 @@ locale_messages_assign(const char *value, bool doit, GucSource source)
131131
if (doit)
132132
{
133133
if (!setlocale(LC_MESSAGES, value))
134+
{
135+
#ifdef WIN32
136+
/*
137+
* Win32 returns NULL when you set LC_MESSAGES to "". So don't
138+
* complain unless we're trying to set it to something else.
139+
*/
140+
if (value[0])
141+
return NULL;
142+
#else
134143
return NULL;
144+
#endif
145+
}
135146
}
136147
else
137148
value = locale_xxx_assign(LC_MESSAGES, value, false, source);
138-
#endif
149+
#endif /* LC_MESSAGES */
139150
return value;
140151
}
141152

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