nmh-workers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


From: Tom Lane
Subject: Re: [nmh-workers] closefds() _before_ fork?
Date: Tue, 23 Apr 2019 12:50:03 -0400

Ken Hornstein <address@hidden> writes:
> I realize that dup2() clears the FD_CLOEXEC flag on the new file
> descriptor so the "normal" case of an opened file being dup2() down to 0
> would work correctly, but the wrinkle is that it does NOT if the old and
> new file descriptor are the same.  That is admittedly unlikely, but it
> could happen in a few cases so I'd like to be as robust as possible.

But is that really an issue?  It'd only occur if you're passing down
your own stdin, which presumably you inherited without FD_CLOEXEC.

                        regards, tom lane



reply via email to

[Prev in Thread] Current Thread [Next in Thread]