diff options
author | Nicholas Marriott <nicm@cvs.openbsd.org> | 2012-09-27 10:02:57 +0000 |
---|---|---|
committer | Nicholas Marriott <nicm@cvs.openbsd.org> | 2012-09-27 10:02:57 +0000 |
commit | f00578bcc5473d72e1b2b4d240bac5bd47492834 (patch) | |
tree | 9d4fef9b4740516dbae177eddbce7d2bee26a155 /usr.bin | |
parent | 7bfd12bc5fb78297658b726a9743fcc6abc23eeb (diff) |
Do not leak file descriptor if not a tty, reported by Sebastien Marie.
Diffstat (limited to 'usr.bin')
-rw-r--r-- | usr.bin/tmux/server-client.c | 8 |
1 files changed, 5 insertions, 3 deletions
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 <nicm@users.sourceforge.net> @@ -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) |