MCPcopy Create free account
hub / github.com/apache/httpd / log_scripterror

Function log_scripterror

modules/generators/cgi_common.h:64–99  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

62}
63
64static int log_scripterror(request_rec *r, cgi_server_conf *conf, int ret,
65 apr_status_t rv, const char *logno,
66 const char *error)
67{
68 apr_file_t *f = NULL;
69 apr_finfo_t finfo;
70 char time_str[APR_CTIME_LEN];
71
72 /* Intentional no APLOGNO */
73 /* Callee provides APLOGNO in error text */
74 ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r,
75 "%sstderr from %s: %s", logno ? logno : "", r->filename, error);
76
77 /* XXX Very expensive mainline case! Open, then getfileinfo! */
78 if (!conf->logname ||
79 ((apr_stat(&finfo, conf->logname,
80 APR_FINFO_SIZE, r->pool) == APR_SUCCESS) &&
81 (finfo.size > conf->logbytes)) ||
82 (apr_file_open(&f, conf->logname,
83 APR_APPEND|APR_WRITE|APR_CREATE, APR_OS_DEFAULT,
84 r->pool) != APR_SUCCESS)) {
85 return ret;
86 }
87
88 /* "%% [Wed Jun 19 10:53:21 1996] GET /cgi-bin/printenv HTTP/1.0" */
89 apr_ctime(time_str, apr_time_now());
90 apr_file_printf(f, "%%%% [%s] %s %s%s%s %s\n", time_str, r->method, r->uri,
91 r->args ? "?" : "", r->args ? r->args : "", r->protocol);
92 /* "%% 500 /usr/local/apache/cgi-bin */
93 apr_file_printf(f, "%%%% %d %s\n", ret, r->filename);
94
95 apr_file_printf(f, "%%error\n%s\n", error);
96
97 apr_file_close(f);
98 return ret;
99}
100
101/* Soak up stderr from a script and redirect it to the error log.
102 */

Callers 4

log_script_errFunction · 0.85
connect_to_daemonFunction · 0.85
cgid_handlerFunction · 0.85
cgi_handlerFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected