Don't call tty_free unless the client is a terminal, otherwise tty_init hasn't

been called and it may end up doing close(0). From Kalle Olavi Niemitalo.
pull/1/head
Nicholas Marriott 2009-08-31 11:37:27 +00:00
parent 2e5b3ab8bc
commit 71ede76c68
1 changed files with 6 additions and 1 deletions

View File

@ -915,7 +915,12 @@ server_lost_client(struct client *c)
}
log_debug("lost client %d", c->ibuf.fd);
tty_free(&c->tty);
/*
* 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);
screen_free(&c->status);