From 1d7c445a1ac0d8e453ad2b306b45883676527061 Mon Sep 17 00:00:00 2001 From: Pierre Pronchery Date: Sun, 10 Mar 2013 00:18:23 +0100 Subject: [PATCH] Report the error when setlocale() fails --- src/desktop.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/desktop.c b/src/desktop.c index a586ffa..94aa6fb 100644 --- a/src/desktop.c +++ b/src/desktop.c @@ -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 */ static int _usage(void) { @@ -2349,7 +2358,8 @@ int main(int argc, char * argv[]) DesktopPrefs prefs; char * p; - setlocale(LC_ALL, ""); + if(setlocale(LC_ALL, "") == NULL) + _error("setlocale", 1); bindtextdomain(PACKAGE, LOCALEDIR); textdomain(PACKAGE); prefs.alignment = -1;