nmh-workers
[Top] [All Lists]

Re: [nmh-workers] closefds() _before_ fork?

2019-04-22 20:09:54
David Levine <levinedl@acm.org> writes:
Ken wrote:
I suggest we simply remove closefds() completely.

Great idea!

Makes sense from here.  You could back-fill use of CLOEXEC anywhere
it seemed important.

Alright, done.

In the "weird things I discovered while doing this" ... I saw in slocal
that when mail is delivered to a process via a pipe, right after fork()
and right before exec(), it uses dup2() to duplicate the file descriptor
pointing to the input message down to 0 (expected), opens /dev/null and
redirects standard output and standard error to it (expected), but ALSO
uses dup2() to make an additional copy of the input file descriptor to
descriptor 3 (!). Does anyone know why?  It looks like it has always
done this.

--Ken

-- 
nmh-workers
https://lists.nongnu.org/mailman/listinfo/nmh-workers

<Prev in Thread] Current Thread [Next in Thread>