From c1f7795dd68dd30b30d5bbb8e53f8af322766a7d Mon Sep 17 00:00:00 2001 From: Tatsuhiro Tsujikawa Date: Wed, 1 Mar 2017 23:20:36 +0900 Subject: [PATCH] nghttpx: Set close-on-exec flag on listener in worker process --- src/shrpx.cc | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/shrpx.cc b/src/shrpx.cc index 6def310d..791cb4c5 100644 --- a/src/shrpx.cc +++ b/src/shrpx.cc @@ -1209,6 +1209,12 @@ pid_t fork_worker_process(int &main_ipc_fd, if (pid == 0) { ev_loop_fork(EV_DEFAULT); + auto config = get_config(); + + for (auto &addr : config->conn.listener.addrs) { + util::make_socket_closeonexec(addr.fd); + } + // Remove all WorkerProcesses to stop any registered watcher on // default loop. worker_process_remove_all();