1
0
mirror of https://github.com/apache/httpd.git synced 2025-08-08 15:02:10 +03:00

Fix the inability to log errors like exec failure in

mod_ext_filter/mod_cgi script children (e.g., exec failure).  This
was broken after such children stopped inheriting the error log
handle.

(For this to work with mod_ext_filter, that module's LogStderr option
has to be on.)


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@99211 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Jeff Trawick
2003-04-04 18:55:49 +00:00
parent 613ac62e83
commit 25be2b6a89
3 changed files with 28 additions and 14 deletions

View File

@@ -2,6 +2,11 @@ Changes with Apache 2.1.0-dev
[Remove entries to the current 2.0 section below, when backported]
*) Fix the inability to log errors like exec failure in
mod_ext_filter/mod_cgi script children (e.g., exec failure). This
was broken after such children stopped inheriting the error log
handle. [Jeff Trawick]
*) Fix a compile failure with recent OpenSSL and picky compilers
(e.g., OpenSSL 0.9.7a and xlc_r on AIX). [Jeff Trawick]

View File

@@ -69,6 +69,7 @@
#include "apr_buckets.h"
#include "util_filter.h"
#include "util_script.h"
#include "util_time.h"
#include "apr_strings.h"
#include "apr_hash.h"
#include "apr_lib.h"
@@ -423,15 +424,25 @@ static apr_status_t ef_close_file(void *vfile)
return apr_file_close(vfile);
}
static void child_errfn(apr_pool_t *p, apr_status_t err, const char *desc)
static void child_errfn(apr_pool_t *pool, apr_status_t err, const char *description)
{
request_rec *r;
void *vr;
apr_file_t *stderr_log;
char errbuf[200];
char time_str[APR_CTIME_LEN];
apr_pool_userdata_get(&vr, ERRFN_USERDATA_KEY, p);
apr_pool_userdata_get(&vr, ERRFN_USERDATA_KEY, pool);
r = vr;
ap_log_rerror(APLOG_MARK, APLOG_ERR, err, r, "%s", desc);
apr_file_open_stderr(&stderr_log, pool);
ap_recent_ctime(time_str, apr_time_now());
apr_file_printf(stderr_log,
"[%s] [client %s] mod_ext_filter (%d)%s: %s\n",
time_str,
r->connection->remote_ip,
err,
apr_strerror(err, errbuf, sizeof(errbuf)),
description);
}
/* init_ext_filter_process: get the external filter process going

View File

@@ -122,8 +122,6 @@ static int is_scriptaliased(request_rec *r)
#define DEFAULT_LOGBYTES 10385760
#define DEFAULT_BUFBYTES 1024
#define ERRFN_USERDATA_KEY "CGICHILDERRFN"
typedef struct {
const char *logname;
long logbytes;
@@ -385,13 +383,15 @@ static void add_ssi_vars(request_rec *r)
static void cgi_child_errfn(apr_pool_t *pool, apr_status_t err,
const char *description)
{
request_rec *r;
void *vr;
apr_file_t *stderr_log;
char errbuf[200];
apr_pool_userdata_get(&vr, ERRFN_USERDATA_KEY, pool);
r = vr;
ap_log_rerror(APLOG_MARK, APLOG_ERR, err, r, "%s", description);
apr_file_open_stderr(&stderr_log, pool);
apr_file_printf(stderr_log,
"(%d)%s: %s\n",
err,
apr_strerror(err, errbuf, sizeof(errbuf)),
description);
}
static apr_status_t run_cgi_child(apr_file_t **script_out,
@@ -473,8 +473,6 @@ static apr_status_t run_cgi_child(apr_file_t **script_out,
"couldn't set child process attributes: %s", r->filename);
}
else {
apr_pool_userdata_set(r, ERRFN_USERDATA_KEY, apr_pool_cleanup_null, p);
procnew = apr_pcalloc(p, sizeof(*procnew));
if (e_info->prog_type == RUN_AS_SSI) {
SPLIT_AND_PASS_PRETAG_BUCKETS(*(e_info->bb), e_info->ctx,