Do not leak file descriptor if not a tty, reported by Sebastien Marie.

This commit is contained in:
Nicholas Marriott 2012-09-27 10:02:56 +00:00
parent 17bbf90393
commit 7a3ec77dbd

View File

@ -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)