Report the error when setlocale() fails

This commit is contained in:
Pierre Pronchery 2013-03-10 00:18:23 +01:00
parent 30387f6d13
commit 1d7c445a1a

View File

@ -2324,6 +2324,15 @@ static void _preferences_set(Desktop * desktop)
} }
/* error */
static int _error(char const * message, int ret)
{
fputs("desktop: ", stderr);
perror(message);
return ret;
}
/* usage */ /* usage */
static int _usage(void) static int _usage(void)
{ {
@ -2349,7 +2358,8 @@ int main(int argc, char * argv[])
DesktopPrefs prefs; DesktopPrefs prefs;
char * p; char * p;
setlocale(LC_ALL, ""); if(setlocale(LC_ALL, "") == NULL)
_error("setlocale", 1);
bindtextdomain(PACKAGE, LOCALEDIR); bindtextdomain(PACKAGE, LOCALEDIR);
textdomain(PACKAGE); textdomain(PACKAGE);
prefs.alignment = -1; prefs.alignment = -1;