coar 98/12/17 06:58:57
Modified: src CHANGES src/support suexec.c Log: fclose(NULL) isn't always a good idea. Submitted by: Rick Franchuk <[EMAIL PROTECTED]> Reviewed by: Ken Coar Revision Changes Path 1.1172 +3 -0 apache-1.3/src/CHANGES Index: CHANGES =================================================================== RCS file: /home/cvs/apache-1.3/src/CHANGES,v retrieving revision 1.1171 retrieving revision 1.1172 diff -u -r1.1171 -r1.1172 --- CHANGES 1998/12/16 15:57:26 1.1171 +++ CHANGES 1998/12/17 14:58:55 1.1172 @@ -1,5 +1,8 @@ Changes with Apache 1.3.4 + *) Fixed problem of fclose() on an unopened file in suexec if LOG_EXEC + wasn't defined. [Rick Franchuk <[EMAIL PROTECTED]>] + *) Removed recently introduced bugs and disfigurements in APACI: o fixed argument line processing: using $args was broken: It was not initialized and using args="$args $apc_option" and even args="$args 1.47 +11 -5 apache-1.3/src/support/suexec.c Index: suexec.c =================================================================== RCS file: /home/cvs/apache-1.3/src/support/suexec.c,v retrieving revision 1.46 retrieving revision 1.47 diff -u -r1.46 -r1.47 --- suexec.c 1998/09/16 20:51:08 1.46 +++ suexec.c 1998/12/17 14:58:57 1.47 @@ -109,7 +109,7 @@ #define AP_ENVBUF 256 extern char **environ; -static FILE *log; +static FILE *log = NULL; char *safe_env_lst[] = { @@ -500,10 +500,16 @@ /* * Be sure to close the log file so the CGI can't * mess with it. If the exec fails, it will be reopened - * automatically when log_err is called. - */ - fclose(log); - log = NULL; + * automatically when log_err is called. Note that the log + * might not actually be open if LOG_EXEC isn't defined. + * However, the "log" cell isn't ifdef'd so let's be defensive + * and assume someone might have done something with it + * outside an ifdef'd LOG_EXEC block. + */ + if (log != NULL) { + fclose(log); + log = NULL; + } /* * Execute the command, replacing our image with its own.