@@ -50,7 +50,7 @@ const char *progname;
50
50
51
51
52
52
static void startup_hacks (const char * progname );
53
- static void init_locale (int category , const char * locale );
53
+ static void init_locale (const char * categoryname , int category , const char * locale );
54
54
static void help (const char * progname );
55
55
static void check_root (const char * progname );
56
56
@@ -123,31 +123,31 @@ main(int argc, char *argv[])
123
123
char * env_locale ;
124
124
125
125
if ((env_locale = getenv ("LC_COLLATE" )) != NULL )
126
- init_locale (LC_COLLATE , env_locale );
126
+ init_locale ("LC_COLLATE" , LC_COLLATE , env_locale );
127
127
else
128
- init_locale (LC_COLLATE , "" );
128
+ init_locale ("LC_COLLATE" , LC_COLLATE , "" );
129
129
130
130
if ((env_locale = getenv ("LC_CTYPE" )) != NULL )
131
- init_locale (LC_CTYPE , env_locale );
131
+ init_locale ("LC_CTYPE" , LC_CTYPE , env_locale );
132
132
else
133
- init_locale (LC_CTYPE , "" );
133
+ init_locale ("LC_CTYPE" , LC_CTYPE , "" );
134
134
}
135
135
#else
136
- init_locale (LC_COLLATE , "" );
137
- init_locale (LC_CTYPE , "" );
136
+ init_locale ("LC_COLLATE" , LC_COLLATE , "" );
137
+ init_locale ("LC_CTYPE" , LC_CTYPE , "" );
138
138
#endif
139
139
140
140
#ifdef LC_MESSAGES
141
- init_locale (LC_MESSAGES , "" );
141
+ init_locale ("LC_MESSAGES" , LC_MESSAGES , "" );
142
142
#endif
143
143
144
144
/*
145
145
* We keep these set to "C" always, except transiently in pg_locale.c; see
146
146
* that file for explanations.
147
147
*/
148
- init_locale (LC_MONETARY , "C" );
149
- init_locale (LC_NUMERIC , "C" );
150
- init_locale (LC_TIME , "C" );
148
+ init_locale ("LC_MONETARY" , LC_MONETARY , "C" );
149
+ init_locale ("LC_NUMERIC" , LC_NUMERIC , "C" );
150
+ init_locale ("LC_TIME" , LC_TIME , "C" );
151
151
152
152
/*
153
153
* Now that we have absorbed as much as we wish to from the locale
@@ -308,11 +308,12 @@ startup_hacks(const char *progname)
308
308
* category's environment variable.
309
309
*/
310
310
static void
311
- init_locale (int category , const char * locale )
311
+ init_locale (const char * categoryname , int category , const char * locale )
312
312
{
313
313
if (pg_perm_setlocale (category , locale ) == NULL &&
314
314
pg_perm_setlocale (category , "C" ) == NULL )
315
- elog (FATAL , "could not adopt C locale" );
315
+ elog (FATAL , "could not adopt \"%s\" locale nor C locale for %s" ,
316
+ locale , categoryname );
316
317
}
317
318
318
319
0 commit comments