From f00578bcc5473d72e1b2b4d240bac5bd47492834 Mon Sep 17 00:00:00 2001 From: Nicholas Marriott Date: Thu, 27 Sep 2012 10:02:57 +0000 Subject: Do not leak file descriptor if not a tty, reported by Sebastien Marie. --- usr.bin/tmux/server-client.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'usr.bin/tmux') diff --git a/usr.bin/tmux/server-client.c b/usr.bin/tmux/server-client.c index 16449d02f30..3e1582b959b 100644 --- a/usr.bin/tmux/server-client.c +++ b/usr.bin/tmux/server-client.c @@ -1,4 +1,4 @@ -/* $OpenBSD: server-client.c,v 1.79 2012/09/03 09:32:38 nicm Exp $ */ +/* $OpenBSD: server-client.c,v 1.80 2012/09/27 10:02:56 nicm Exp $ */ /* * Copyright (c) 2009 Nicholas Marriott @@ -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) -- cgit v1.2.3