summaryrefslogtreecommitdiffstats
path: root/src/eval.c
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@tavianator.com>2022-12-09 11:59:26 -0500
committerTavian Barnes <tavianator@tavianator.com>2022-12-09 11:59:49 -0500
commitd0e8026d650bb4318ea8608865d5f5a011366dcc (patch)
treeb291854144b237e5c58c7f3dffe32ceb3a71c01a /src/eval.c
parent0cc598f1628167599131756e909630dc36d33610 (diff)
downloadbfs-d0e8026d650bb4318ea8608865d5f5a011366dcc.tar.xz
Turn on more aggressive format string warnings
Diffstat (limited to 'src/eval.c')
-rw-r--r--src/eval.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/eval.c b/src/eval.c
index e3257ce..89591b2 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -716,11 +716,13 @@ bool eval_fls(const struct bfs_expr *expr, struct bfs_eval *state) {
goto error;
}
char time_str[256];
- const char *time_format = "%b %e %H:%M";
+ size_t time_ret;
if (time <= six_months_ago || time >= tomorrow) {
- time_format = "%b %e %Y";
+ time_ret = strftime(time_str, sizeof(time_str), "%b %e %Y", &tm);
+ } else {
+ time_ret = strftime(time_str, sizeof(time_str), "%b %e %H:%M", &tm);
}
- if (!strftime(time_str, sizeof(time_str), time_format, &tm)) {
+ if (time_ret == 0) {
errno = EOVERFLOW;
goto error;
}