aboutsummaryrefslogtreecommitdiff
path: root/server-client.c
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@openbsd.org>2012-09-27 10:02:56 +0000
committerNicholas Marriott <nicm@openbsd.org>2012-09-27 10:02:56 +0000
commit7a3ec77dbdb43058bfd810ed7a63f645c8521ee0 (patch)
tree222ee23a4519159c08b58f74668e90cf2e7160ab /server-client.c
parent17bbf90393a5599cfe82becdc5c29a7ad48012c4 (diff)
downloadrtmux-7a3ec77dbdb43058bfd810ed7a63f645c8521ee0.tar.gz
rtmux-7a3ec77dbdb43058bfd810ed7a63f645c8521ee0.tar.bz2
rtmux-7a3ec77dbdb43058bfd810ed7a63f645c8521ee0.zip
Do not leak file descriptor if not a tty, reported by Sebastien Marie.
Diffstat (limited to 'server-client.c')
-rw-r--r--server-client.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/server-client.c b/server-client.c
index 7b7a3e4a..7f5bfe13 100644
--- a/server-client.c
+++ b/server-client.c
@@ -912,8 +912,10 @@ server_client_msg_identify(
return;
}
- if (!isatty(fd))
- return;
+ if (!isatty(fd)) {
+ close(fd);
+ return;
+ }
data->term[(sizeof data->term) - 1] = '\0';
tty_init(&c->tty, c, fd, data->term);
if (data->flags & IDENTIFY_UTF8)