Issue #649 init_env shouldn't guess the return value of open(2)

Declined
#49 · Created  · Last updated

Declined pull request

Thank you for patch and investigation of the issue, we have integrated the patch with minor modifications (hence merge decline, but the patch was added: https://bitbucket.org/tildeslash/monit/commits/869a526a8d33) Best regards, The Monit team

Closed by: ·2017-09-18

Description

Don't try to guess what file descriptor will be returned by open(2). It's unreliable. For example, it isn't thread safe. Use dup2(2) instead. dup2 also closes the destination file descriptor, which is something this function wants to do anyway.

While I'm here, fix a file descriptor leak.

0 attachments

0 comments

Loading commits...