From d7013b0f158322e74f6d1cab3e84f0d1494aa4b3 Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Thu, 27 May 2004 19:19:05 +0000 Subject: [PATCH] On WIN32, don't choke when setlocale(LC_MESSAGES, "") returns NULL. Per report from Magnus. --- src/backend/utils/adt/pg_locale.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/backend/utils/adt/pg_locale.c b/src/backend/utils/adt/pg_locale.c index 5c2e951be1..b22021ed1c 100644 --- a/src/backend/utils/adt/pg_locale.c +++ b/src/backend/utils/adt/pg_locale.c @@ -4,7 +4,7 @@ * * Portions Copyright (c) 2002-2003, PostgreSQL Global Development Group * - * $PostgreSQL: pgsql/src/backend/utils/adt/pg_locale.c,v 1.25 2004/01/19 19:04:40 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/utils/adt/pg_locale.c,v 1.26 2004/05/27 19:19:05 tgl Exp $ * *----------------------------------------------------------------------- */ @@ -131,11 +131,22 @@ locale_messages_assign(const char *value, bool doit, GucSource source) if (doit) { if (!setlocale(LC_MESSAGES, value)) + { +#ifdef WIN32 + /* + * Win32 returns NULL when you set LC_MESSAGES to "". So don't + * complain unless we're trying to set it to something else. + */ + if (value[0]) + return NULL; +#else return NULL; +#endif + } } else value = locale_xxx_assign(LC_MESSAGES, value, false, source); -#endif +#endif /* LC_MESSAGES */ return value; } -- 2.40.0