diff --git a/server.c b/server.c index d4e1fffd..8dc946e0 100644 --- a/server.c +++ b/server.c @@ -1,4 +1,4 @@ -/* $Id: server.c,v 1.175 2009-08-24 16:27:03 tcunha Exp $ */ +/* $Id: server.c,v 1.176 2009-08-31 22:24:18 tcunha Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -918,7 +918,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);