rse 98/10/03 07:07:09
Modified: src CHANGES src/main http_log.c Log: Fix stderr redirection under syslog-based error logging situation. PS: This is actually an extracted sub-patch of a large patch which contains lots of style changes, too. The style changes I'll commit in a second round (I don't want to commit the stuff mixed together). Only one change (2->STDERR_FILENO) is committed also now, because it's more like a bugfix. Submitted by: Youichirou Koga <[EMAIL PROTECTED]> PR: 3095 Revision Changes Path 1.1092 +3 -0 apache-1.3/src/CHANGES Index: CHANGES =================================================================== RCS file: /export/home/cvs/apache-1.3/src/CHANGES,v retrieving revision 1.1091 retrieving revision 1.1092 diff -u -r1.1091 -r1.1092 --- CHANGES 1998/10/03 13:38:29 1.1091 +++ CHANGES 1998/10/03 14:07:07 1.1092 @@ -1,5 +1,8 @@ Changes with Apache 1.3.3 + *) Fix stderr redirection under syslog-based error logging situation. + [Youichirou Koga <[EMAIL PROTECTED]>] PR#3095 + *) Document `ErrorLog syslog:facility' variant of error logging. [Youichirou Koga <[EMAIL PROTECTED]>] PR#3096 1.71 +4 -3 apache-1.3/src/main/http_log.c Index: http_log.c =================================================================== RCS file: /export/home/cvs/apache-1.3/src/main/http_log.c,v retrieving revision 1.70 retrieving revision 1.71 diff -u -r1.70 -r1.71 --- http_log.c 1998/09/25 12:27:05 1.70 +++ http_log.c 1998/10/03 14:07:08 1.71 @@ -239,7 +239,7 @@ if (s_main->error_log) { /* replace stderr with this new log */ fflush(stderr); - if (dup2(fileno(s_main->error_log), 2) == -1) { + if (dup2(fileno(s_main->error_log), STDERR_FILENO) == -1) { ap_log_error(APLOG_MARK, APLOG_CRIT, s_main, "unable to replace stderr with error_log"); } else { @@ -271,8 +271,9 @@ } API_EXPORT(void) ap_error_log2stderr (server_rec *s) { - if(fileno(s->error_log) != STDERR_FILENO) - dup2(fileno(s->error_log),STDERR_FILENO); + if ( s->error_log != NULL + && fileno(s->error_log) != STDERR_FILENO) + dup2(fileno(s->error_log), STDERR_FILENO); } static void log_error_core (const char *file, int line, int level,