From a5bda368db347f5bd169ef6b39aa6badfc60f8c3 Mon Sep 17 00:00:00 2001 From: Pierre Pronchery Date: Thu, 1 Oct 2015 21:32:57 +0200 Subject: [PATCH] Report errors from setlocale(3) --- src/panelctl.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/panelctl.c b/src/panelctl.c index 267aa63..14ae0f2 100644 --- a/src/panelctl.c +++ b/src/panelctl.c @@ -45,6 +45,8 @@ /* private */ /* prototypes */ static int _panelctl(PanelMessageShow what, gboolean show); + +static int _error(char const * message, int ret); static int _usage(void); @@ -57,6 +59,15 @@ static int _panelctl(PanelMessageShow what, gboolean show) } +/* error */ +static int _error(char const * message, int ret) +{ + fputs(PROGNAME ": ", stderr); + perror(message); + return ret; +} + + /* usage */ static int _usage(void) { @@ -83,7 +94,8 @@ int main(int argc, char * argv[]) int what = -1; gboolean show = TRUE; - setlocale(LC_ALL, ""); + if(setlocale(LC_ALL, "") == NULL) + _error("setlocale", 1); bindtextdomain(PACKAGE, LOCALEDIR); textdomain(PACKAGE); gtk_init(&argc, &argv);