Soak up stderr from a script and redirect it to the error log. */
| 101 | /* Soak up stderr from a script and redirect it to the error log. |
| 102 | */ |
| 103 | static apr_status_t log_script_err(request_rec *r, apr_file_t *script_err) |
| 104 | { |
| 105 | char argsbuffer[HUGE_STRING_LEN]; |
| 106 | char *newline; |
| 107 | apr_status_t rv; |
| 108 | cgi_server_conf *conf = ap_get_module_config(r->server->module_config, &cgi_module); |
| 109 | |
| 110 | while ((rv = apr_file_gets(argsbuffer, HUGE_STRING_LEN, |
| 111 | script_err)) == APR_SUCCESS) { |
| 112 | |
| 113 | newline = strchr(argsbuffer, '\n'); |
| 114 | if (newline) { |
| 115 | char *prev = newline - 1; |
| 116 | if (prev >= argsbuffer && *prev == '\r') { |
| 117 | newline = prev; |
| 118 | } |
| 119 | |
| 120 | *newline = '\0'; |
| 121 | } |
| 122 | log_scripterror(r, conf, r->status, 0, APLOGNO(01215), argsbuffer); |
| 123 | } |
| 124 | |
| 125 | return rv; |
| 126 | } |
| 127 | |
| 128 | static apr_status_t cgi_handle_exec(include_ctx_t *ctx, ap_filter_t *f, |
| 129 | apr_bucket_brigade *bb) |
no test coverage detected