fdpass_recv: Set O_CLOEXEC on received fds
Turns out this is necessary even if the fd is going to be passed through exec() soon, because the supervisor might receive multiple fds before spawning another process, in which case all of them are going to be passed to the new process instead of just one.
This commit is contained in:
parent
9e1be5bc71
commit
2f50736782
3 changed files with 9 additions and 13 deletions
|
|
@ -458,10 +458,9 @@ Like regular socket I/O, a single C<fdpass_send()> message may be split across
|
|||
multiple C<fdpass_recv()> calls; in that case the C<$fd> is only received on
|
||||
the first call.
|
||||
|
||||
Don't use this function if the sender may include multiple file descriptors in
|
||||
a single message, weird things can happen. File descriptors received this way
|
||||
do not have the C<CLOEXEC> flag and will thus survive a call to C<exec()>.
|
||||
Refer to L<this wonderful
|
||||
The C<O_CLOEXEC> flag is set on received file descriptors. Don't use this
|
||||
function if the sender may include multiple file descriptors in a single
|
||||
message, weird things can happen. Refer to L<this wonderful
|
||||
discussion|https://gist.github.com/kentonv/bc7592af98c68ba2738f4436920868dc>
|
||||
for more weirdness and edge cases.
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue