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

Re: Feature request: ZSH_XTRACEFD variable



(Peter, for some reason Gmail is classifying all email from
ntlworld.com as spam, with the notation that it "can't guarantee that
this message came from ntlworld.com")

On Tue, May 5, 2020 at 9:48 AM Peter Stephenson
<p.w.stephenson@xxxxxxxxxxxx> wrote:
>
>
> The problem is if we fopen() the file descriptor to use stdio as output, we can either
> leak the entire FILE, not opened by the user, or we can close the entire FILE.

In that case we should be doing the fopen() on a dup() of the
descriptor, and fclose()ing the FILE.

If it is important that fileno(xtrerr) == $ZSH_XTRACEFD, then we should
1) dup() the descriptor to save a copy
2) fopen() the original
3) after fclose(), dup2() the copy back to the original
4) close() the copy

However, I'm not sure it's necessary to be that convoluted.



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