pty/tty release issue

Andrei Paskevich andrei at capet.iut-fbleau.fr
Wed Jan 17 02:08:23 CET 2007


On Tue, 16 Jan 2007 at 11:37:52 (+0100), Andrei Paskevich wrote:
> ===================== proof-of-concept patch =====================
> --- rxvt-unicode-8.1/src/proxy.C	2006-12-07 04:18:34.000000000 +0100
> +++ rxvt-unicode-8.1-ap/src/proxy.C	2007-01-16 11:14:49.000000000 +0100
> @@ -127,6 +127,13 @@
>      {
>        NEED_TOKEN;
> 
> +      close_tty(); // redundant (init.C:1378)
> +
> +      if (this->pty >= 0)
> +        close (this->pty);
> +
> +      this->pty = -1; // redundant, too
> +
>        command cmd;
> 
>        cmd.type = command::destroy;
> ========================= end of the diff ========================

Just an afterthought: the close_tty() call above is necessary and 
not redundant at all. This is because the call at (init.C:1378), 
which closes the daemon's tty fd, does not belong to libptytty
and nothing guarantees that every other application will close
its ttys as well. So it's up to libptytty code to ensure that
all the spare file descriptors are closed when a ptytty_proxy
object is destroyed.

Best regards,
Andrei





More information about the rxvt-unicode mailing list