diff options
author | Tavian Barnes <tavianator@tavianator.com> | 2022-12-09 11:59:26 -0500 |
---|---|---|
committer | Tavian Barnes <tavianator@tavianator.com> | 2022-12-09 11:59:49 -0500 |
commit | d0e8026d650bb4318ea8608865d5f5a011366dcc (patch) | |
tree | b291854144b237e5c58c7f3dffe32ceb3a71c01a /src/eval.c | |
parent | 0cc598f1628167599131756e909630dc36d33610 (diff) | |
download | bfs-d0e8026d650bb4318ea8608865d5f5a011366dcc.tar.xz |
Turn on more aggressive format string warnings
Diffstat (limited to 'src/eval.c')
-rw-r--r-- | src/eval.c | 8 |
1 files changed, 5 insertions, 3 deletions
@@ -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; } |