Closed GoogleCodeExporter closed 8 years ago
Believe a more complete patch is as follows. One can't just skip the whole
process as technically not all virtual
hosts might be being redirected to syslog for logging.
Note that patch here is against trunk, but should still apply to mod_wsgi 3.1
cleanly.
Index: mod_wsgi.c
===================================================================
--- mod_wsgi.c (revision 1529)
+++ mod_wsgi.c (working copy)
@@ -11117,30 +11117,42 @@
/*
* Iterate over all servers and close any error
- * logs different to that for virtual host.
+ * logs different to that for virtual host. Note that
+ * if errors are being redirected to syslog, then
+ * the server error log reference will actually be
+ * a null pointer, so need to ensure that check for
+ * that and don't attempt to close it in that case.
*/
server = wsgi_server;
while (server != NULL) {
- if (server->error_log != daemon->group->server->error_log)
+ if (server->error_log &&
+ server->error_log != daemon->group->server->error_log) {
apr_file_close(server->error_log);
+ }
server = server->next;
}
/*
- * Reassociate stderr output with error log from the
- * virtual host the daemon is associated with. Close
- * the virtual host error log and point it at stderr
- * log instead. Do the latter so don't get two
- * references to same open file. Just in case
- * anything still accesses error log of main server,
- * map main server error log to that of the virtual
- * host.
+ * Reassociate stderr output with error log from the
+ * virtual host the daemon is associated with. Close
+ * the virtual host error log and point it at stderr
+ * log instead. Do the latter so don't get two
+ * references to same open file. Just in case
+ * anything still accesses error log of main server,
+ * map main server error log to that of the virtual
+ * host. Note that cant do this if errors are being
+ * redirected to syslog, as indicated by virtual
+ * host error log being a null pointer. In that case
+ * just leave everything as it was. Also can't remap
+ * the error log for main server if it was being
+ * redirected to syslog but virtual host wasn't.
*/
- if (daemon->group->server->error_log != wsgi_server->error_log) {
+ if (daemon->group->server->error_log &&
+ daemon->group->server->error_log != wsgi_server->error_log) {
apr_file_open_stderr(&errfile, wsgi_server->process->pool);
apr_file_dup2(errfile, daemon->group->server->error_log,
wsgi_server->process->pool);
@@ -11148,7 +11160,8 @@
apr_file_close(daemon->group->server->error_log);
daemon->group->server->error_log = errfile;
- wsgi_server->error_log = daemon->group->server->error_log;
+ if (wsgi_server->error_log)
+ wsgi_server->error_log = daemon->group->server->error_log;
}
}
Original comment by Graham.Dumpleton@gmail.com
on 31 Jan 2010 at 2:30
Version 3.2 of mod_wsgi released with this fix.
Original comment by Graham.Dumpleton@gmail.com
on 9 Mar 2010 at 10:11
Original comment by Graham.Dumpleton@gmail.com
on 9 Mar 2010 at 10:13
Original issue reported on code.google.com by
jf.feuerstein@googlemail.com
on 28 Jan 2010 at 7:48