@@ -43,7 +43,7 @@ const char *progname;
43
43
44
44
45
45
static void startup_hacks (const char * progname );
46
- static void init_locale (int category , const char * locale );
46
+ static void init_locale (const char * categoryname , int category , const char * locale );
47
47
static void help (const char * progname );
48
48
static void check_root (const char * progname );
49
49
@@ -116,31 +116,31 @@ main(int argc, char *argv[])
116
116
char * env_locale ;
117
117
118
118
if ((env_locale = getenv ("LC_COLLATE" )) != NULL )
119
- init_locale (LC_COLLATE , env_locale );
119
+ init_locale ("LC_COLLATE" , LC_COLLATE , env_locale );
120
120
else
121
- init_locale (LC_COLLATE , "" );
121
+ init_locale ("LC_COLLATE" , LC_COLLATE , "" );
122
122
123
123
if ((env_locale = getenv ("LC_CTYPE" )) != NULL )
124
- init_locale (LC_CTYPE , env_locale );
124
+ init_locale ("LC_CTYPE" , LC_CTYPE , env_locale );
125
125
else
126
- init_locale (LC_CTYPE , "" );
126
+ init_locale ("LC_CTYPE" , LC_CTYPE , "" );
127
127
}
128
128
#else
129
- init_locale (LC_COLLATE , "" );
130
- init_locale (LC_CTYPE , "" );
129
+ init_locale ("LC_COLLATE" , LC_COLLATE , "" );
130
+ init_locale ("LC_CTYPE" , LC_CTYPE , "" );
131
131
#endif
132
132
133
133
#ifdef LC_MESSAGES
134
- init_locale (LC_MESSAGES , "" );
134
+ init_locale ("LC_MESSAGES" , LC_MESSAGES , "" );
135
135
#endif
136
136
137
137
/*
138
138
* We keep these set to "C" always, except transiently in pg_locale.c; see
139
139
* that file for explanations.
140
140
*/
141
- init_locale (LC_MONETARY , "C" );
142
- init_locale (LC_NUMERIC , "C" );
143
- init_locale (LC_TIME , "C" );
141
+ init_locale ("LC_MONETARY" , LC_MONETARY , "C" );
142
+ init_locale ("LC_NUMERIC" , LC_NUMERIC , "C" );
143
+ init_locale ("LC_TIME" , LC_TIME , "C" );
144
144
145
145
/*
146
146
* Now that we have absorbed as much as we wish to from the locale
@@ -280,11 +280,12 @@ startup_hacks(const char *progname)
280
280
* category's environment variable.
281
281
*/
282
282
static void
283
- init_locale (int category , const char * locale )
283
+ init_locale (const char * categoryname , int category , const char * locale )
284
284
{
285
285
if (pg_perm_setlocale (category , locale ) == NULL &&
286
286
pg_perm_setlocale (category , "C" ) == NULL )
287
- elog (FATAL , "could not adopt C locale" );
287
+ elog (FATAL , "could not adopt \"%s\" locale nor C locale for %s" ,
288
+ locale , categoryname );
288
289
}
289
290
290
291
0 commit comments