mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-08-10 09:07:02 +02:00
MINOR: startup: add O_CLOEXEC flag to open /dev/null
As master process performs execvp() syscall to handle USR2 and HUP signals in mworker_reexec(), let's add O_CLOEXEC flag, when we open '/dev/null' in order to avoid fd leak. This a preparation step to refactor master-worker logic. See more details in the next commits.
This commit is contained in:
parent
5bbcdc003a
commit
df12791da3
@ -3704,7 +3704,7 @@ int main(int argc, char **argv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!(global.mode & MODE_QUIET) || (global.mode & MODE_VERBOSE)) {
|
if (!(global.mode & MODE_QUIET) || (global.mode & MODE_VERBOSE)) {
|
||||||
devnullfd = open("/dev/null", O_RDWR, 0);
|
devnullfd = open("/dev/null", (O_RDWR | O_CLOEXEC), 0);
|
||||||
if (devnullfd < 0) {
|
if (devnullfd < 0) {
|
||||||
ha_alert("Cannot open /dev/null\n");
|
ha_alert("Cannot open /dev/null\n");
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
|
Loading…
Reference in New Issue
Block a user