summaryrefslogtreecommitdiff
path: root/usr.bin/tmux
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@cvs.openbsd.org>2009-08-31 11:37:28 +0000
committerNicholas Marriott <nicm@cvs.openbsd.org>2009-08-31 11:37:28 +0000
commit32c85c48795b5a7f9d126abea21b7c3e58f42c84 (patch)
tree357c753a885331c048ab7ecada670a0b0214c442 /usr.bin/tmux
parentcab1195793690cd7ee1745767c3988907a8d20b4 (diff)
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 'usr.bin/tmux')
-rw-r--r--usr.bin/tmux/server.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/usr.bin/tmux/server.c b/usr.bin/tmux/server.c
index c665a745389..33f5be07739 100644
--- a/usr.bin/tmux/server.c
+++ b/usr.bin/tmux/server.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: server.c,v 1.24 2009/08/23 17:29:51 nicm Exp $ */
+/* $OpenBSD: server.c,v 1.25 2009/08/31 11:37:27 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -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);