nmh-workers
[Top] [All Lists]

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

2019-04-23 11:04:31
It's not the only one, e.g. docs/historical/mh-6.8.5/uip/post.c has

    2622             if (fd != 0)
    2623                 (void) dup2 (fd, 0);
    2624             (void) freopen ("/dev/null", "w", stdout);
    2625             (void) freopen ("/dev/null", "w", stderr);
    2626             if (fd != 3)        /* backwards compatible... */
    2627                 (void) dup2 (fd, 3);
    2628             closefds (4);

Note the comment.

The *real* WTF there is that the code doesn't actually know if fd 3 is
known to be open on a file that should, or if it's just a stray leaked fd.

Wow.  So do any greybeards out there have any idea of why this is there??
Clearly this was a thing, but I have no idea why.  I see that same code
in MH 5, so it's been that way for approximately forever.

--Ken

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

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