Merge branch 'obsd-master'

pull/1798/head
Thomas Adam 2019-06-07 23:02:26 +01:00
commit e13c1e5320
3 changed files with 11 additions and 7 deletions

View File

@ -1521,7 +1521,9 @@ server_client_click_timer(__unused int fd, __unused short events, void *data)
static void static void
server_client_check_exit(struct client *c) server_client_check_exit(struct client *c)
{ {
if (!(c->flags & CLIENT_EXIT)) if (~c->flags & CLIENT_EXIT)
return;
if (c->flags & CLIENT_EXITED)
return; return;
if (EVBUFFER_LENGTH(c->stdin_data) != 0) if (EVBUFFER_LENGTH(c->stdin_data) != 0)
@ -1534,7 +1536,7 @@ server_client_check_exit(struct client *c)
if (c->flags & CLIENT_ATTACHED) if (c->flags & CLIENT_ATTACHED)
notify_client("client-detached", c); notify_client("client-detached", c);
proc_send(c->peer, MSG_EXIT, -1, &c->retval, sizeof c->retval); proc_send(c->peer, MSG_EXIT, -1, &c->retval, sizeof c->retval);
c->flags &= ~CLIENT_EXIT; c->flags |= CLIENT_EXITED;
} }
/* Redraw timer callback. */ /* Redraw timer callback. */

View File

@ -43,7 +43,7 @@
struct clients clients; struct clients clients;
struct tmuxproc *server_proc; struct tmuxproc *server_proc;
static int server_fd; static int server_fd = -1;
static int server_exit; static int server_exit;
static struct event server_ev_accept; static struct event server_ev_accept;
@ -207,11 +207,10 @@ server_start(struct tmuxproc *client, struct event_base *base, int lockfd,
cmdq_append(c, cmdq_get_error(cause)); cmdq_append(c, cmdq_get_error(cause));
free(cause); free(cause);
c->flags |= CLIENT_EXIT; c->flags |= CLIENT_EXIT;
} } else
start_cfg();
start_cfg();
server_add_accept(0); server_add_accept(0);
proc_loop(server_proc, server_loop); proc_loop(server_proc, server_loop);
job_kill_all(); job_kill_all();
@ -363,6 +362,9 @@ server_add_accept(int timeout)
{ {
struct timeval tv = { timeout, 0 }; struct timeval tv = { timeout, 0 };
if (server_fd == -1)
return;
if (event_initialized(&server_ev_accept)) if (event_initialized(&server_ev_accept))
event_del(&server_ev_accept); event_del(&server_ev_accept);

2
tmux.h
View File

@ -1492,7 +1492,7 @@ struct client {
#define CLIENT_REPEAT 0x20 #define CLIENT_REPEAT 0x20
#define CLIENT_SUSPENDED 0x40 #define CLIENT_SUSPENDED 0x40
#define CLIENT_ATTACHED 0x80 #define CLIENT_ATTACHED 0x80
/* 0x100 unused */ #define CLIENT_EXITED 0x100
#define CLIENT_DEAD 0x200 #define CLIENT_DEAD 0x200
#define CLIENT_REDRAWBORDERS 0x400 #define CLIENT_REDRAWBORDERS 0x400
#define CLIENT_READONLY 0x800 #define CLIENT_READONLY 0x800