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