Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

RE: PATCH: Re: zpty and controlling tty (and other fd's)



Andrej Borsenkow wrote:

> > On True64 Unix O_NOCTTY is implicit and cannot be unset. How weird.
> 
> Hmm ... if I correctly recall, first tty opened by process becomes
> controlling tty. It means, that if child has closed all of it's file
> descriptors and reopens tty for stdin (duplicating it for stdout,
> stderr) - it gets it as controlling tty. It should be fairly portable.

What I said with the above is that on True64 Unix opening a terminal
in a process with no controlling tty does *not* make that terminal the 
controlling tty of the process.

So: `how weird'.

> ...
> 
> Note fd's 3 and 13. 3 is master side of pty (child does not need it,
> does it?)

Of course I tried to close it -- and on Linux this messed up the
parent's (i.e. the shell's) terminal settings. Don't know how this
came.

> And 13 is left over from wordcode file mapping. Mapping itself
> goes away after exec (at least here - I expect, it should be true for
> all Unices) - but we have to close fd anyway.

Ah, right. I don't use wordcode files in development versions.


This adds the closedumps() function and makes it be called in zpty.c
and zexecve(). Does anyone know of other places where it should be
called?


Bye
 Sven


--
Sven Wischnowsky                         wischnow@xxxxxxxxxxxxxxxxxxxxxxx



Messages sorted by: Reverse Date, Date, Thread, Author