]> code.delx.au - spectrwm/commitdiff
Warn the user if format is too long.
authorTiago Cunha <tcunha@gmx.com>
Sun, 13 May 2012 21:52:23 +0000 (22:52 +0100)
committerTiago Cunha <tcunha@gmx.com>
Tue, 5 Jun 2012 21:32:01 +0000 (22:32 +0100)
spectrwm.c

index 082d04ea2d19d78f67fc73d7ac9e41cada19e191..abf3d20165511a62a72eaeeac567a7f7ecee16a8 100644 (file)
@@ -1575,7 +1575,8 @@ bar_fmt_expand(char *fmtexp, size_t sz)
        strlcpy(fmtexp, fmt, sz);
        /* finally pass the string through strftime(3) */
 #ifndef SWM_DENY_CLOCK_FORMAT
-       len = strftime(fmtexp, sz, fmt, &tm);
+       if ((len = strftime(fmtexp, sz, fmt, &tm)) == 0)
+               warnx("format too long");
        fmtexp[len] = '\0';
 #endif
 }