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.
}
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) {
ha_alert("Cannot open /dev/null\n");
exit(EXIT_FAILURE);