mirror of
https://github.com/tmux/tmux.git
synced 2026-04-02 02:16:27 +00:00
Merge master.
This commit is contained in:
19
format.c
19
format.c
@@ -454,6 +454,20 @@ format_job_tidy(struct format_job_tree *jobs, int force)
|
||||
}
|
||||
}
|
||||
|
||||
/* Work around needless -Wformat-nonliteral gcc warning. */
|
||||
#ifdef __GNUC__
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wformat-nonliteral"
|
||||
#endif
|
||||
static size_t
|
||||
format_strftime(char *s, size_t max, const char *fmt, const struct tm *tm)
|
||||
{
|
||||
return (strftime(s, max, fmt, tm));
|
||||
}
|
||||
#ifdef __GNUC__
|
||||
#pragma GCC diagnostic pop
|
||||
#endif
|
||||
|
||||
/* Tidy old jobs for all clients. */
|
||||
void
|
||||
format_tidy_jobs(void)
|
||||
@@ -3963,7 +3977,7 @@ found:
|
||||
else {
|
||||
if (time_format != NULL) {
|
||||
localtime_r(&t, &tm);
|
||||
strftime(s, sizeof s, time_format, &tm);
|
||||
format_strftime(s, sizeof s, time_format, &tm);
|
||||
} else {
|
||||
ctime_r(&t, s);
|
||||
s[strcspn(s, "\n")] = '\0';
|
||||
@@ -5540,7 +5554,8 @@ format_expand1(struct format_expand_state *es, const char *fmt)
|
||||
es->time = time(NULL);
|
||||
localtime_r(&es->time, &es->tm);
|
||||
}
|
||||
if (strftime(expanded, sizeof expanded, fmt, &es->tm) == 0) {
|
||||
if (format_strftime(expanded, sizeof expanded, fmt,
|
||||
&es->tm) == 0) {
|
||||
format_log(es, "format is too long");
|
||||
return (xstrdup(""));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user