@@ -43,7 +43,7 @@ const char *progname;
4343
4444
4545static 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 );
4747static void help (const char * progname );
4848static void check_root (const char * progname );
4949
@@ -116,31 +116,31 @@ main(int argc, char *argv[])
116116 char * env_locale ;
117117
118118 if ((env_locale = getenv ("LC_COLLATE" )) != NULL )
119- init_locale (LC_COLLATE , env_locale );
119+ init_locale ("LC_COLLATE" , LC_COLLATE , env_locale );
120120 else
121- init_locale (LC_COLLATE , "" );
121+ init_locale ("LC_COLLATE" , LC_COLLATE , "" );
122122
123123 if ((env_locale = getenv ("LC_CTYPE" )) != NULL )
124- init_locale (LC_CTYPE , env_locale );
124+ init_locale ("LC_CTYPE" , LC_CTYPE , env_locale );
125125 else
126- init_locale (LC_CTYPE , "" );
126+ init_locale ("LC_CTYPE" , LC_CTYPE , "" );
127127 }
128128#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 , "" );
131131#endif
132132
133133#ifdef LC_MESSAGES
134- init_locale (LC_MESSAGES , "" );
134+ init_locale ("LC_MESSAGES" , LC_MESSAGES , "" );
135135#endif
136136
137137 /*
138138 * We keep these set to "C" always, except transiently in pg_locale.c; see
139139 * that file for explanations.
140140 */
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" );
144144
145145 /*
146146 * Now that we have absorbed as much as we wish to from the locale
@@ -280,11 +280,12 @@ startup_hacks(const char *progname)
280280 * category's environment variable.
281281 */
282282static void
283- init_locale (int category , const char * locale )
283+ init_locale (const char * categoryname , int category , const char * locale )
284284{
285285 if (pg_perm_setlocale (category , locale ) == NULL &&
286286 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 );
288289}
289290
290291
0 commit comments