From 7a3ec77dbdb43058bfd810ed7a63f645c8521ee0 Mon Sep 17 00:00:00 2001 From: Nicholas Marriott Date: Thu, 27 Sep 2012 10:02:56 +0000 Subject: [PATCH] Do not leak file descriptor if not a tty, reported by Sebastien Marie. --- server-client.c | 6 ++++-- 1 file 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)