nmh-workers
[Top] [All Lists]

[nmh-workers] closefds() _before_ fork?

2019-04-22 14:56:46
I've been having a problem when occasionally at a What now? prompt when
I use the "send" command the process will get killed with a -9 out of
nowhere (this is on MacOS X High Sierra).  I finally realized that the
same problem is causing the test suite to fail for the dist test, so I
decided to track it down.

The short answer is: it's because of closefds().  Specifically, the call
in the "sendit()" function in whatnowsbr.c, right before the call to
sendsbr().  What is happening is there is a specific descriptor marked as
something called the "NETPOLICY" descriptor, and if that is closed your
process is killed.

I understand why functions like closefds() are used right before exec(),
but in this case a fair amonut of stuff happens before exec is called,
and it's way before fork() is eventually called as well.  The other uses
of closefds() are after a fork() occurs, or right before exec() happens
(see whom.c).  Can anyone think of a reason that for this specific
case closefds() should NOT be moved from whatnowbr.c (and send.c) into
sendsbr.c, and just in the child process?

--Ken

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

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