diff options
author | Tiago Cunha <tcunha@gmx.com> | 2009-08-31 22:24:18 +0000 |
---|---|---|
committer | Tiago Cunha <tcunha@gmx.com> | 2009-08-31 22:24:18 +0000 |
commit | 86fb9737dcc212893d18991eade111a2b41e9efb (patch) | |
tree | b764bc3f63ddfad2ffc49b3e40dea5b8eeba2e3b /server.c | |
parent | d15e88cb688fa1d799920e35f0676fdcb3995a79 (diff) | |
download | rtmux-86fb9737dcc212893d18991eade111a2b41e9efb.tar.gz rtmux-86fb9737dcc212893d18991eade111a2b41e9efb.tar.bz2 rtmux-86fb9737dcc212893d18991eade111a2b41e9efb.zip |
Sync OpenBSD patchset 300:
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.
Diffstat (limited to 'server.c')
-rw-r--r-- | server.c | 9 |
1 files changed, 7 insertions, 2 deletions
@@ -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 <nicm@users.sourceforge.net> @@ -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); |