mirror of
https://github.com/tmux/tmux.git
synced 2025-09-02 05:21:10 +00:00
Merge branch 'obsd-master'
This commit is contained in:
18
server.c
18
server.c
@ -218,16 +218,30 @@ server_loop(void)
|
||||
int
|
||||
server_should_shutdown(void)
|
||||
{
|
||||
u_int i;
|
||||
struct client *c;
|
||||
u_int i;
|
||||
|
||||
if (!options_get_number(&global_options, "exit-unattached")) {
|
||||
if (!RB_EMPTY(&sessions))
|
||||
return (0);
|
||||
}
|
||||
|
||||
for (i = 0; i < ARRAY_LENGTH(&clients); i++) {
|
||||
c = ARRAY_ITEM(&clients, i);
|
||||
if (c != NULL && c->session != NULL)
|
||||
return (0);
|
||||
}
|
||||
|
||||
/*
|
||||
* No attached clients therefore want to exit - flush any waiting
|
||||
* clients but don't actually exit until they've gone.
|
||||
*/
|
||||
cmd_wait_for_flush();
|
||||
for (i = 0; i < ARRAY_LENGTH(&clients); i++) {
|
||||
if (ARRAY_ITEM(&clients, i) != NULL)
|
||||
return (0);
|
||||
}
|
||||
|
||||
return (1);
|
||||
}
|
||||
|
||||
@ -239,6 +253,8 @@ server_send_shutdown(void)
|
||||
struct session *s, *next_s;
|
||||
u_int i;
|
||||
|
||||
cmd_wait_for_flush();
|
||||
|
||||
for (i = 0; i < ARRAY_LENGTH(&clients); i++) {
|
||||
c = ARRAY_ITEM(&clients, i);
|
||||
if (c != NULL) {
|
||||
|
Reference in New Issue
Block a user