mirror of
https://github.com/tmux/tmux.git
synced 2025-09-01 20:57:00 +00:00
Handle NULL client (in config file) when showing a status message; also
copy the file when processing if-shell since it may be freed. GitHub issue 3746.
This commit is contained in:
25
status.c
25
status.c
@ -472,17 +472,26 @@ void
|
||||
status_message_set(struct client *c, int delay, int ignore_styles,
|
||||
int ignore_keys, const char *fmt, ...)
|
||||
{
|
||||
struct timeval tv;
|
||||
va_list ap;
|
||||
struct timeval tv;
|
||||
va_list ap;
|
||||
char *s;
|
||||
|
||||
va_start(ap, fmt);
|
||||
xvasprintf(&s, fmt, ap);
|
||||
va_end(ap);
|
||||
|
||||
log_debug("%s: %s", __func__, s);
|
||||
|
||||
if (c == NULL) {
|
||||
server_add_message("message: %s", s);
|
||||
free(s);
|
||||
return;
|
||||
}
|
||||
|
||||
status_message_clear(c);
|
||||
status_push_screen(c);
|
||||
|
||||
va_start(ap, fmt);
|
||||
xvasprintf(&c->message_string, fmt, ap);
|
||||
va_end(ap);
|
||||
|
||||
server_add_message("%s message: %s", c->name, c->message_string);
|
||||
c->message_string = s;
|
||||
server_add_message("%s message: %s", c->name, s);
|
||||
|
||||
/*
|
||||
* With delay -1, the display-time option is used; zero means wait for
|
||||
|
Reference in New Issue
Block a user