From e1645ed287632b681b5ac4653d36f48fcf50e45b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20B=C3=BChler?= Date: Sat, 11 Jul 2009 09:01:18 +0000 Subject: [PATCH] Set FD_CLOEXEC for bound sockets before pipe-logger forks (fixes #2026) git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-1.4.x@2578 152afb58-edef-0310-8abb-c4023f1b3aa9 --- NEWS | 1 + src/network.c | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/NEWS b/NEWS index a61e48c5..805c797f 100644 --- a/NEWS +++ b/NEWS @@ -16,6 +16,7 @@ NEWS * Fix unused function webdav_lockdiscovery in mod_webdav * cmake: Fix crypt lib check * cmake: Add -export-dynamic to link flags, fixes build on FreeBSD + * Set FD_CLOEXEC for bound sockets before pipe-logger forks (fixes #2026) - 1.4.23 - 2009-06-19 * Added some extra warning options in cmake and fix the resulting warnings (unused/static functions) diff --git a/src/network.c b/src/network.c index e2d5f0b9..40901041 100644 --- a/src/network.c +++ b/src/network.c @@ -167,6 +167,11 @@ static int network_server_init(server *srv, buffer *host_token, specific_config } } +#ifdef FD_CLOEXEC + /* set FD_CLOEXEC now, fdevent_fcntl_set is called later; needed for pipe-logger forks */ + fcntl(srv_socket->fd, F_SETFD, FD_CLOEXEC); +#endif + /* */ srv->cur_fds = srv_socket->fd;