mirror of
https://github.com/tmux/tmux.git
synced 2025-09-02 05:21:10 +00:00
Now the tty has a pointer back to the client there is no point (and a
bit confusing) in it keeping a copy of the fd as well. Remove it.
This commit is contained in:
@ -229,7 +229,6 @@ server_client_create(int fd)
|
||||
RB_INIT(&c->windows);
|
||||
RB_INIT(&c->files);
|
||||
|
||||
c->tty.fd = -1;
|
||||
c->tty.sx = 80;
|
||||
c->tty.sy = 24;
|
||||
|
||||
@ -307,10 +306,6 @@ server_client_lost(struct client *c)
|
||||
TAILQ_REMOVE(&clients, c, entry);
|
||||
log_debug("lost client %p", c);
|
||||
|
||||
/*
|
||||
* If CLIENT_TERMINAL hasn't been set, then tty_init hasn't been called
|
||||
* and tty_free might close an unrelated fd.
|
||||
*/
|
||||
if (c->flags & CLIENT_TERMINAL)
|
||||
tty_free(&c->tty);
|
||||
free(c->ttyname);
|
||||
@ -342,6 +337,10 @@ server_client_lost(struct client *c)
|
||||
proc_remove_peer(c->peer);
|
||||
c->peer = NULL;
|
||||
|
||||
if (c->fd != -1) {
|
||||
close(c->fd);
|
||||
c->fd = -1;
|
||||
}
|
||||
server_client_unref(c);
|
||||
|
||||
server_add_accept(0); /* may be more file descriptors now */
|
||||
@ -2008,7 +2007,7 @@ server_client_dispatch(struct imsg *imsg, void *arg)
|
||||
break;
|
||||
c->flags &= ~CLIENT_SUSPENDED;
|
||||
|
||||
if (c->tty.fd == -1) /* exited in the meantime */
|
||||
if (c->fd == -1) /* exited in the meantime */
|
||||
break;
|
||||
s = c->session;
|
||||
|
||||
@ -2210,11 +2209,9 @@ server_client_dispatch_identify(struct client *c, struct imsg *imsg)
|
||||
if (c->flags & CLIENT_CONTROL) {
|
||||
close(c->fd);
|
||||
c->fd = -1;
|
||||
|
||||
control_start(c);
|
||||
c->tty.fd = -1;
|
||||
} else if (c->fd != -1) {
|
||||
if (tty_init(&c->tty, c, c->fd) != 0) {
|
||||
if (tty_init(&c->tty, c) != 0) {
|
||||
close(c->fd);
|
||||
c->fd = -1;
|
||||
} else {
|
||||
|
Reference in New Issue
Block a user