]> rtime.felk.cvut.cz Git - can-utils.git/commitdiff
asc2log: inform about uninstalled locales at date conversion failures
authorOliver Hartkopp <socketcan@hartkopp.net>
Thu, 28 Nov 2013 15:12:17 +0000 (16:12 +0100)
committerOliver Hartkopp <socketcan@hartkopp.net>
Thu, 28 Nov 2013 15:12:17 +0000 (16:12 +0100)
Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
asc2log.c

index bb1baab8e480d325250d46c138d8d33c126e0f19..548fc7ee400680bc38f16f630f5fbe5db2a1747d 100644 (file)
--- a/asc2log.c
+++ b/asc2log.c
@@ -132,8 +132,10 @@ int get_date(struct timeval *tv, char *date) {
        if (sscanf(date, "%9s %d %9s %9s %d", ctmp, &itmp, ctmp, ctmp, &itmp) == 5) {
                /* assume EN/US date due to existing am/pm field */
 
-               if (!setlocale(LC_TIME, "en_US"))
+               if (!setlocale(LC_TIME, "en_US")) {
+                       fprintf(stderr, "Setting locale to 'en_US' failed!\n");
                        return 1;
+               }
 
                if (!strptime(date, "%B %d %r %Y", &tms))
                        return 1;
@@ -144,8 +146,10 @@ int get_date(struct timeval *tv, char *date) {
                if (sscanf(date, "%9s %d %9s %d", ctmp, &itmp, ctmp, &itmp) != 4)
                        return 1;
 
-               if (!setlocale(LC_TIME, "de_DE"))
+               if (!setlocale(LC_TIME, "de_DE")) {
+                       fprintf(stderr, "Setting locale to 'de_DE' failed!\n");
                        return 1;
+               }
 
                if (!strptime(date, "%B %d %T %Y", &tms))
                        return 1;