mirror of
https://github.com/tmux/tmux.git
synced 2024-12-12 17:38:48 +00:00
Do not load the config file if the server is exiting because it failed
to start, otherwise commands like lsk which start the server again can end up looping infinitely. Also make the first client exit correctly. Problem reported by Wael M Nasreddine.
This commit is contained in:
parent
8f40796f05
commit
e37f34facc
@ -1511,7 +1511,9 @@ server_client_click_timer(__unused int fd, __unused short events, void *data)
|
||||
static void
|
||||
server_client_check_exit(struct client *c)
|
||||
{
|
||||
if (!(c->flags & CLIENT_EXIT))
|
||||
if (~c->flags & CLIENT_EXIT)
|
||||
return;
|
||||
if (c->flags & CLIENT_EXITED)
|
||||
return;
|
||||
|
||||
if (EVBUFFER_LENGTH(c->stdin_data) != 0)
|
||||
@ -1524,7 +1526,7 @@ server_client_check_exit(struct client *c)
|
||||
if (c->flags & CLIENT_ATTACHED)
|
||||
notify_client("client-detached", c);
|
||||
proc_send(c->peer, MSG_EXIT, -1, &c->retval, sizeof c->retval);
|
||||
c->flags &= ~CLIENT_EXIT;
|
||||
c->flags |= CLIENT_EXITED;
|
||||
}
|
||||
|
||||
/* Redraw timer callback. */
|
||||
|
10
server.c
10
server.c
@ -44,7 +44,7 @@
|
||||
struct clients clients;
|
||||
|
||||
struct tmuxproc *server_proc;
|
||||
static int server_fd;
|
||||
static int server_fd = -1;
|
||||
static int server_exit;
|
||||
static struct event server_ev_accept;
|
||||
|
||||
@ -208,11 +208,10 @@ server_start(struct tmuxproc *client, struct event_base *base, int lockfd,
|
||||
cmdq_append(c, cmdq_get_error(cause));
|
||||
free(cause);
|
||||
c->flags |= CLIENT_EXIT;
|
||||
}
|
||||
} else
|
||||
start_cfg();
|
||||
|
||||
start_cfg();
|
||||
server_add_accept(0);
|
||||
|
||||
proc_loop(server_proc, server_loop);
|
||||
|
||||
job_kill_all();
|
||||
@ -364,6 +363,9 @@ server_add_accept(int timeout)
|
||||
{
|
||||
struct timeval tv = { timeout, 0 };
|
||||
|
||||
if (server_fd == -1)
|
||||
return;
|
||||
|
||||
if (event_initialized(&server_ev_accept))
|
||||
event_del(&server_ev_accept);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user