SOURCES: lighttpd-errorlog-before-fork.patch (NEW) - raw from http://home.h...

glen glen at pld-linux.org
Tue Oct 7 12:37:57 CEST 2008


Author: glen                         Date: Tue Oct  7 10:37:57 2008 GMT
Module: SOURCES                       Tag: HEAD
---- Log message:
- raw from http://home.hoffie.info/lighttpd-1.4.19-errorlog-before-fork.patch

---- Files affected:
SOURCES:
   lighttpd-errorlog-before-fork.patch (NONE -> 1.1)  (NEW)

---- Diffs:

================================================================
Index: SOURCES/lighttpd-errorlog-before-fork.patch
diff -u /dev/null SOURCES/lighttpd-errorlog-before-fork.patch:1.1
--- /dev/null	Tue Oct  7 12:37:57 2008
+++ SOURCES/lighttpd-errorlog-before-fork.patch	Tue Oct  7 12:37:51 2008
@@ -0,0 +1,39 @@
+diff -r 25b65b5d810e src/server.c
+--- a/src/server.c	Mon May 26 18:12:54 2008 +0200
++++ b/src/server.c	Mon May 26 18:30:43 2008 +0200
+@@ -876,6 +876,17 @@
+ 		return -1;
+ 	}
+ 
++	// Close stderr ASAP to make sure that nothing is being written to
++	// that fd which may not be valid anymore after forking
++	if (-1 == log_error_open(srv)) {
++		log_error_write(srv, __FILE__, __LINE__, "s", "Opening errorlog failed. Going down.");
++
++		plugins_free(srv);
++		network_close(srv);
++		server_free(srv);
++		return -1;
++	}
++
+ #ifdef HAVE_FORK
+ 	/* network is up, let's deamonize ourself */
+ 	if (srv->srvconf.dont_daemonize == 0) daemonize();
+@@ -891,17 +902,6 @@
+ 		write(pid_fd, srv->tmp_buf->ptr, srv->tmp_buf->used - 1);
+ 		close(pid_fd);
+ 		pid_fd = -1;
+-	}
+-
+-	// Close stderr ASAP in the child process to make sure that nothing
+-	// is being written to that fd which may not be valid anymore.
+-	if (-1 == log_error_open(srv)) {
+-		log_error_write(srv, __FILE__, __LINE__, "s", "Opening errorlog failed. Going down.");
+-
+-		plugins_free(srv);
+-		network_close(srv);
+-		server_free(srv);
+-		return -1;
+ 	}
+ 
+ 	if (HANDLER_GO_ON != plugins_call_set_defaults(srv)) {
================================================================


More information about the pld-cvs-commit mailing list