From e8dd19c1f78dde9dd6b2614557487c2761fd2ec9 Mon Sep 17 00:00:00 2001 From: Tiago Cunha Date: Sun, 13 May 2012 22:52:23 +0100 Subject: [PATCH] Warn the user if format is too long. --- spectrwm.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/spectrwm.c b/spectrwm.c index 082d04e..abf3d20 100644 --- a/spectrwm.c +++ b/spectrwm.c @@ -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 } -- 2.39.2