apr_status codes in our error logs. The main advantage of this, is portable
error codes. Now, Windows will finally be able to use errno!
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@84007
13f79535-47bb-0310-9956-
ffa450edef68
26 files changed:
* attack and other messy behavior. Instead, use a simple format string
* like "%s", followed by the string containing the untrusted data.
*/
* attack and other messy behavior. Instead, use a simple format string
* like "%s", followed by the string containing the untrusted data.
*/
-API_EXPORT(void) ap_log_error(const char *file, int line, int level,
- const server_rec *s, const char *fmt, ...)
- __attribute__((format(printf,5,6)));
-API_EXPORT(void) ap_log_rerror(const char *file, int line, int level,
- const request_rec *s, const char *fmt, ...)
- __attribute__((format(printf,5,6)));
+API_EXPORT(void) ap_log_error(const char *file, int line, int level,
+ ap_status_t status, const server_rec *s,
+ const char *fmt, ...)
+ __attribute__((format(printf,6,7)));
+API_EXPORT(void) ap_log_rerror(const char *file, int line, int level,
+ ap_status_t status, const request_rec *s,
+ const char *fmt, ...)
+ __attribute__((format(printf,6,7)));
API_EXPORT(void) ap_error_log2stderr (server_rec *);
void ap_log_pid (ap_context_t *p, const char *fname);
API_EXPORT(void) ap_error_log2stderr (server_rec *);
void ap_log_pid (ap_context_t *p, const char *fname);
if (ret == FORBIDDEN
&& (ap_satisfies(r) != SATISFY_ANY || !ap_some_auth_required(r))) {
if (ret == FORBIDDEN
&& (ap_satisfies(r) != SATISFY_ANY || !ap_some_auth_required(r))) {
- ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, r,
+ ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, 0, r,
"client denied by server configuration: %s",
r->filename);
}
"client denied by server configuration: %s",
r->filename);
}
const char *rpw, *w;
if (!(f = ap_pcfg_openfile(r->pool, auth_pwfile))) {
const char *rpw, *w;
if (!(f = ap_pcfg_openfile(r->pool, auth_pwfile))) {
- ap_log_rerror(APLOG_MARK, APLOG_ERR, r,
+ ap_log_rerror(APLOG_MARK, APLOG_ERR, errno, r,
"Could not open password file: %s", auth_pwfile);
return NULL;
}
"Could not open password file: %s", auth_pwfile);
return NULL;
}
if (!(real_pw = get_pw(r, r->user, sec->auth_pwfile))) {
if (!(sec->auth_authoritative))
return DECLINED;
if (!(real_pw = get_pw(r, r->user, sec->auth_pwfile))) {
if (!(sec->auth_authoritative))
return DECLINED;
- ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, r,
+ ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, 0, r,
"user %s not found: %s", r->user, r->uri);
ap_note_basic_auth_failure(r);
return AUTH_REQUIRED;
}
invalid_pw = ap_validate_password(sent_pw, real_pw);
if (invalid_pw != NULL) {
"user %s not found: %s", r->user, r->uri);
ap_note_basic_auth_failure(r);
return AUTH_REQUIRED;
}
invalid_pw = ap_validate_password(sent_pw, real_pw);
if (invalid_pw != NULL) {
- ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, r,
+ ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, 0, r,
"user %s: authentication failure for \"%s\": %s",
r->user, r->uri, invalid_pw);
ap_note_basic_auth_failure(r);
"user %s: authentication failure for \"%s\": %s",
r->user, r->uri, invalid_pw);
ap_note_basic_auth_failure(r);
* That something could be a missing "AuthAuthoritative off", but
* more likely is a typo in the require directive.
*/
* That something could be a missing "AuthAuthoritative off", but
* more likely is a typo in the require directive.
*/
- ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, r,
+ ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, 0, r,
"access to %s failed, reason: unknown require directive:"
"\"%s\"", r->uri, reqs[x].requirement);
}
"access to %s failed, reason: unknown require directive:"
"\"%s\"", r->uri, reqs[x].requirement);
}
if (!(sec->auth_authoritative))
return DECLINED;
if (!(sec->auth_authoritative))
return DECLINED;
- ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, r,
+ ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, 0, r,
"access to %s failed, reason: user %s not allowed access",
r->uri, user);
"access to %s failed, reason: user %s not allowed access",
r->uri, user);
static int asis_handler(request_rec *r)
{
ap_file_t *f;
static int asis_handler(request_rec *r)
{
ap_file_t *f;
const char *location;
FILE *thefile; /* XXX leave these alone until we convert */
int thefd; /* everything to use apr_file_t's. */
const char *location;
FILE *thefile; /* XXX leave these alone until we convert */
int thefd; /* everything to use apr_file_t's. */
if (r->method_number != M_GET)
return DECLINED;
if (r->finfo.st_mode == 0) {
if (r->method_number != M_GET)
return DECLINED;
if (r->finfo.st_mode == 0) {
- ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, r,
+ ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, 0, r,
"File does not exist: %s", r->filename);
return NOT_FOUND;
}
"File does not exist: %s", r->filename);
return NOT_FOUND;
}
- if (ap_open(&f, r->filename, APR_READ | APR_BUFFERED,
- APR_OS_DEFAULT, r->pool) != APR_SUCCESS) {
- ap_log_rerror(APLOG_MARK, APLOG_ERR, r,
+ if ((status = ap_open(&f, r->filename, APR_READ | APR_BUFFERED,
+ APR_OS_DEFAULT, r->pool)) != APR_SUCCESS) {
+ ap_log_rerror(APLOG_MARK, APLOG_ERR, status, r,
"file permissions deny server access: %s", r->filename);
return FORBIDDEN;
}
"file permissions deny server access: %s", r->filename);
return FORBIDDEN;
}
char *name = r->filename;
ap_dir_t *d;
char *name = r->filename;
ap_dir_t *d;
int num_ent = 0, x;
struct ent *head, *p;
struct ent **ar = NULL;
int num_ent = 0, x;
struct ent *head, *p;
struct ent **ar = NULL;
char keyid;
char direction;
char keyid;
char direction;
- if (ap_opendir(&d, name, r->pool) != APR_SUCCESS) {
- ap_log_rerror(APLOG_MARK, APLOG_ERR, r,
+ if ((status = ap_opendir(&d, name, r->pool)) != APR_SUCCESS) {
+ ap_log_rerror(APLOG_MARK, APLOG_ERR, status, r,
"Can't open directory for index: %s", r->filename);
return HTTP_FORBIDDEN;
}
"Can't open directory for index: %s", r->filename);
return HTTP_FORBIDDEN;
}
return index_directory(r, d);
}
else {
return index_directory(r, d);
}
else {
- ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, r,
+ ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, 0, r,
"Directory index forbidden by rule: %s", r->filename);
return HTTP_FORBIDDEN;
}
"Directory index forbidden by rule: %s", r->filename);
return HTTP_FORBIDDEN;
}
if (*interpreter)
return eFileTypeSCRIPT;
else {
if (*interpreter)
return eFileTypeSCRIPT;
else {
- ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_INFO, r->server,
+ ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_INFO, 0, r->server,
"ScriptInterpreterSource config directive set to \"registry\".\n\t"
"Registry was searched but interpreter not found. Trying the shebang line.");
}
"ScriptInterpreterSource config directive set to \"registry\".\n\t"
"Registry was searched but interpreter not found. Trying the shebang line.");
}
if (error_number == 401 &&
line[0] != '/' && line[0] != '"') { /* Ignore it... */
if (error_number == 401 &&
line[0] != '/' && line[0] != '"') { /* Ignore it... */
- ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_NOTICE, cmd->server,
+ ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_NOTICE, 0, cmd->server,
"cannot use a full URL in a 401 ErrorDocument "
"directive --- ignoring!");
}
"cannot use a full URL in a 401 ErrorDocument "
"directive --- ignoring!");
}
return HTTP_FORBIDDEN;
}
if ((r->uri[0] != '/') && strcmp(r->uri, "*")) {
return HTTP_FORBIDDEN;
}
if ((r->uri[0] != '/') && strcmp(r->uri, "*")) {
- ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, r,
+ ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, 0, r,
"Invalid URI in request %s", r->the_request);
return BAD_REQUEST;
}
"Invalid URI in request %s", r->the_request);
return BAD_REQUEST;
}
struct mmap_rec *mmd = mmv;
if (munmap(mmd->mm, mmd->length) == -1) {
struct mmap_rec *mmd = mmv;
if (munmap(mmd->mm, mmd->length) == -1) {
- ap_log_error(APLOG_MARK, APLOG_ERR, NULL,
+ ap_log_error(APLOG_MARK, APLOG_ERR, errno, NULL,
"Failed to munmap memory of length %ld at 0x%lx",
(long) mmd->length, (long) mmd->mm);
}
"Failed to munmap memory of length %ld at 0x%lx",
(long) mmd->length, (long) mmd->mm);
}
int rangestatus, errstatus;
ap_file_t *fd = NULL;
int fd_os;
int rangestatus, errstatus;
ap_file_t *fd = NULL;
int fd_os;
#ifdef USE_MMAP_FILES
caddr_t mm;
#endif
#ifdef USE_MMAP_FILES
caddr_t mm;
#endif
r->allowed |= (1 << M_GET) | (1 << M_OPTIONS);
if (r->method_number == M_INVALID) {
r->allowed |= (1 << M_GET) | (1 << M_OPTIONS);
if (r->method_number == M_INVALID) {
- ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, r,
+ ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, 0, r,
"Invalid method in request %s", r->the_request);
return NOT_IMPLEMENTED;
}
"Invalid method in request %s", r->the_request);
return NOT_IMPLEMENTED;
}
}
/* ZZZ can we store if the file exists or not? */
if (r->finfo.st_mode == 0 || (r->path_info && *r->path_info)) {
}
/* ZZZ can we store if the file exists or not? */
if (r->finfo.st_mode == 0 || (r->path_info && *r->path_info)) {
- ap_log_rerror(APLOG_MARK, APLOG_ERR|APLOG_NOERRNO, r,
+ ap_log_rerror(APLOG_MARK, APLOG_ERR|APLOG_NOERRNO, 0, r,
"File does not exist: %s",r->path_info ?
ap_pstrcat(r->pool, r->filename, r->path_info, NULL)
: r->filename);
"File does not exist: %s",r->path_info ?
ap_pstrcat(r->pool, r->filename, r->path_info, NULL)
: r->filename);
return METHOD_NOT_ALLOWED;
}
return METHOD_NOT_ALLOWED;
}
- if (ap_open (&fd, r->filename, APR_READ | APR_BINARY, 0, r->pool) != APR_SUCCESS) {
- ap_log_rerror(APLOG_MARK, APLOG_ERR, r,
+ if ((status = ap_open(&fd, r->filename, APR_READ | APR_BINARY, 0, r->pool)) != APR_SUCCESS) {
+ ap_log_rerror(APLOG_MARK, APLOG_ERR, status, r,
"file permissions deny server access: %s", r->filename);
return FORBIDDEN;
}
"file permissions deny server access: %s", r->filename);
return FORBIDDEN;
}
mm = mmap(NULL, r->finfo.st_size, PROT_READ, MAP_PRIVATE,
fd_os, 0);
if (mm == (caddr_t)-1) {
mm = mmap(NULL, r->finfo.st_size, PROT_READ, MAP_PRIVATE,
fd_os, 0);
if (mm == (caddr_t)-1) {
- ap_log_rerror(APLOG_MARK, APLOG_CRIT, r,
+ ap_log_rerror(APLOG_MARK, APLOG_CRIT, errno, r,
"default_handler: mmap failed: %s", r->filename);
}
}
"default_handler: mmap failed: %s", r->filename);
}
}
ap_off_t offset;
while (ap_each_byterange(r, &offset, &length)) {
ap_off_t offset;
while (ap_each_byterange(r, &offset, &length)) {
- if (ap_seek(fd, APR_SET, &offset) != APR_SUCCESS) {
- ap_log_error(APLOG_MARK, APLOG_ERR, r->server,
+ if ((status = ap_seek(fd, APR_SET, &offset)) != APR_SUCCESS) {
+ ap_log_error(APLOG_MARK, APLOG_ERR, status, r->server,
"error byteserving file: %s", r->filename);
ap_close(fd);
return HTTP_INTERNAL_SERVER_ERROR;
"error byteserving file: %s", r->filename);
ap_close(fd);
return HTTP_INTERNAL_SERVER_ERROR;
/* Get the request... */
if (!read_request_line(r)) {
if (r->status == HTTP_REQUEST_URI_TOO_LARGE) {
/* Get the request... */
if (!read_request_line(r)) {
if (r->status == HTTP_REQUEST_URI_TOO_LARGE) {
- ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, r,
+ ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, 0, r,
"request failed: URI too long");
ap_send_error_response(r, 0);
ap_run_log_transaction(r);
"request failed: URI too long");
ap_send_error_response(r, 0);
ap_run_log_transaction(r);
if (!r->assbackwards) {
get_mime_headers(r);
if (r->status != HTTP_REQUEST_TIME_OUT) {
if (!r->assbackwards) {
get_mime_headers(r);
if (r->status != HTTP_REQUEST_TIME_OUT) {
- ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, r,
+ ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, 0, r,
"request failed: error reading the headers");
ap_send_error_response(r, 0);
ap_run_log_transaction(r);
"request failed: error reading the headers");
ap_send_error_response(r, 0);
ap_run_log_transaction(r);
* headers! Have to dink things just to make sure the error message
* comes through...
*/
* headers! Have to dink things just to make sure the error message
* comes through...
*/
- ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, r,
+ ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, 0, r,
"client sent invalid HTTP/0.9 request: HEAD %s",
r->uri);
r->header_only = 0;
"client sent invalid HTTP/0.9 request: HEAD %s",
r->uri);
r->header_only = 0;
* a Host: header, and the server MUST respond with 400 if it doesn't.
*/
r->status = HTTP_BAD_REQUEST;
* a Host: header, and the server MUST respond with 400 if it doesn't.
*/
r->status = HTTP_BAD_REQUEST;
- ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, r,
+ ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, 0, r,
"client sent HTTP/1.1 request without hostname "
"(see RFC2068 section 9, and 14.23): %s", r->uri);
ap_send_error_response(r, 0);
"client sent HTTP/1.1 request without hostname "
"(see RFC2068 section 9, and 14.23): %s", r->uri);
ap_send_error_response(r, 0);
}
else {
r->status = HTTP_EXPECTATION_FAILED;
}
else {
r->status = HTTP_EXPECTATION_FAILED;
- ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_INFO, r,
+ ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_INFO, 0, r,
"client sent an unrecognized expectation value of "
"Expect: %s", expect);
ap_send_error_response(r, 0);
"client sent an unrecognized expectation value of "
"Expect: %s", expect);
ap_send_error_response(r, 0);
if (!ap_auth_name(r)) {
ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR,
if (!ap_auth_name(r)) {
ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR,
- r, "need AuthName: %s", r->uri);
+ 0, r, "need AuthName: %s", r->uri);
if (strcasecmp(ap_getword(r->pool, &auth_line, ' '), "Basic")) {
/* Client tried to authenticate using wrong auth scheme */
if (strcasecmp(ap_getword(r->pool, &auth_line, ' '), "Basic")) {
/* Client tried to authenticate using wrong auth scheme */
- ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, r,
+ ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, 0, r,
"client used wrong authentication scheme: %s", r->uri);
ap_note_basic_auth_failure(r);
return AUTH_REQUIRED;
"client used wrong authentication scheme: %s", r->uri);
ap_note_basic_auth_failure(r);
return AUTH_REQUIRED;
if (tenc) {
if (strcasecmp(tenc, "chunked")) {
if (tenc) {
if (strcasecmp(tenc, "chunked")) {
- ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, r,
+ ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, 0, r,
"Unknown Transfer-Encoding %s", tenc);
return HTTP_NOT_IMPLEMENTED;
}
if (r->read_body == REQUEST_CHUNKED_ERROR) {
"Unknown Transfer-Encoding %s", tenc);
return HTTP_NOT_IMPLEMENTED;
}
if (r->read_body == REQUEST_CHUNKED_ERROR) {
- ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, r,
+ ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, 0, r,
"chunked Transfer-Encoding forbidden: %s", r->uri);
return (lenp) ? HTTP_BAD_REQUEST : HTTP_LENGTH_REQUIRED;
}
"chunked Transfer-Encoding forbidden: %s", r->uri);
return (lenp) ? HTTP_BAD_REQUEST : HTTP_LENGTH_REQUIRED;
}
while (ap_isdigit(*pos) || ap_isspace(*pos))
++pos;
if (*pos != '\0') {
while (ap_isdigit(*pos) || ap_isspace(*pos))
++pos;
if (*pos != '\0') {
- ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, r,
+ ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, 0, r,
"Invalid Content-Length %s", lenp);
return HTTP_BAD_REQUEST;
}
"Invalid Content-Length %s", lenp);
return HTTP_BAD_REQUEST;
}
if ((r->read_body == REQUEST_NO_BODY) &&
(r->read_chunked || (r->remaining > 0))) {
if ((r->read_body == REQUEST_NO_BODY) &&
(r->read_chunked || (r->remaining > 0))) {
- ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, r,
+ ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, 0, r,
"%s with body is not allowed for %s", r->method, r->uri);
return HTTP_REQUEST_ENTITY_TOO_LARGE;
}
max_body = ap_get_limit_req_body(r);
if (max_body && (r->remaining > max_body)) {
"%s with body is not allowed for %s", r->method, r->uri);
return HTTP_REQUEST_ENTITY_TOO_LARGE;
}
max_body = ap_get_limit_req_body(r);
if (max_body && (r->remaining > max_body)) {
- ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, r,
+ ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, 0, r,
"Request content-length of %s is larger than the configured "
"limit of %lu", lenp, max_body);
return HTTP_REQUEST_ENTITY_TOO_LARGE;
"Request content-length of %s is larger than the configured "
"limit of %lu", lenp, max_body);
return HTTP_REQUEST_ENTITY_TOO_LARGE;
*/
max_body = ap_get_limit_req_body(r);
if (max_body && (r->read_length > max_body)) {
*/
max_body = ap_get_limit_req_body(r);
if (max_body && (r->read_length > max_body)) {
- ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, r,
+ ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, 0, r,
"Chunked request body is larger than the configured limit of %lu",
max_body);
r->connection->keepalive = -1;
"Chunked request body is larger than the configured limit of %lu",
max_body);
r->connection->keepalive = -1;
}
else if (w < 0) {
if (!ap_is_aborted(r->connection)) {
}
else if (w < 0) {
if (!ap_is_aborted(r->connection)) {
- ap_log_rerror(APLOG_MARK, APLOG_INFO, r,
+ ap_log_rerror(APLOG_MARK, APLOG_INFO, errno, r,
"client stopped connection before send body completed");
ap_bsetflag(r->connection->client, B_EOUT, 1);
r->connection->aborted = 1;
"client stopped connection before send body completed");
ap_bsetflag(r->connection->client, B_EOUT, 1);
r->connection->aborted = 1;
}
else if (w < 0) {
if (!ap_is_aborted(r->connection)) {
}
else if (w < 0) {
if (!ap_is_aborted(r->connection)) {
- ap_log_rerror(APLOG_MARK, APLOG_INFO, r,
+ ap_log_rerror(APLOG_MARK, APLOG_INFO, errno, r,
"client stopped connection before rflush completed");
ap_bsetflag(r->connection->client, B_EOUT, 1);
r->connection->aborted = 1;
"client stopped connection before rflush completed");
ap_bsetflag(r->connection->client, B_EOUT, 1);
r->connection->aborted = 1;
else if (errno == EAGAIN)
continue;
else {
else if (errno == EAGAIN)
continue;
else {
- ap_log_rerror(APLOG_MARK, APLOG_INFO, r,
+ ap_log_rerror(APLOG_MARK, APLOG_INFO, errno, r,
"client stopped connection before send mmap completed");
ap_bsetflag(r->connection->client, B_EOUT, 1);
r->connection->aborted = 1;
"client stopped connection before send mmap completed");
ap_bsetflag(r->connection->client, B_EOUT, 1);
r->connection->aborted = 1;
if (ap_bputc(c, r->connection->client) < 0) {
if (!r->connection->aborted) {
if (ap_bputc(c, r->connection->client) < 0) {
if (!r->connection->aborted) {
- ap_log_rerror(APLOG_MARK, APLOG_INFO, r,
+ ap_log_rerror(APLOG_MARK, APLOG_INFO, errno, r,
"client stopped connection before rputc completed");
ap_bsetflag(r->connection->client, B_EOUT, 1);
r->connection->aborted = 1;
"client stopped connection before rputc completed");
ap_bsetflag(r->connection->client, B_EOUT, 1);
r->connection->aborted = 1;
rcode = ap_bputs(str, r->connection->client);
if (rcode < 0) {
if (!r->connection->aborted) {
rcode = ap_bputs(str, r->connection->client);
if (rcode < 0) {
if (!r->connection->aborted) {
- ap_log_rerror(APLOG_MARK, APLOG_INFO, r,
+ ap_log_rerror(APLOG_MARK, APLOG_INFO, errno, r,
"client stopped connection before rputs completed");
ap_bsetflag(r->connection->client, B_EOUT, 1);
r->connection->aborted = 1;
"client stopped connection before rputs completed");
ap_bsetflag(r->connection->client, B_EOUT, 1);
r->connection->aborted = 1;
n = ap_bwrite(r->connection->client, buf, nbyte);
if (n < 0) {
if (!r->connection->aborted) {
n = ap_bwrite(r->connection->client, buf, nbyte);
if (n < 0) {
if (!r->connection->aborted) {
- ap_log_rerror(APLOG_MARK, APLOG_INFO, r,
+ ap_log_rerror(APLOG_MARK, APLOG_INFO, errno, r,
"client stopped connection before rwrite completed");
ap_bsetflag(r->connection->client, B_EOUT, 1);
r->connection->aborted = 1;
"client stopped connection before rwrite completed");
ap_bsetflag(r->connection->client, B_EOUT, 1);
r->connection->aborted = 1;
if (n < 0) {
if (!r->connection->aborted) {
if (n < 0) {
if (!r->connection->aborted) {
- ap_log_rerror(APLOG_MARK, APLOG_INFO, r,
+ ap_log_rerror(APLOG_MARK, APLOG_INFO, errno, r,
"client stopped connection before vrprintf completed");
ap_bsetflag(r->connection->client, B_EOUT, 1);
r->connection->aborted = 1;
"client stopped connection before vrprintf completed");
ap_bsetflag(r->connection->client, B_EOUT, 1);
r->connection->aborted = 1;
if (n < 0) {
if (!r->connection->aborted) {
if (n < 0) {
if (!r->connection->aborted) {
- ap_log_rerror(APLOG_MARK, APLOG_INFO, r,
+ ap_log_rerror(APLOG_MARK, APLOG_INFO, errno, r,
"client stopped connection before rprintf completed");
ap_bsetflag(r->connection->client, B_EOUT, 1);
r->connection->aborted = 1;
"client stopped connection before rprintf completed");
ap_bsetflag(r->connection->client, B_EOUT, 1);
r->connection->aborted = 1;
if (i != j) {
va_end(args);
if (!r->connection->aborted) {
if (i != j) {
va_end(args);
if (!r->connection->aborted) {
- ap_log_rerror(APLOG_MARK, APLOG_INFO, r,
+ ap_log_rerror(APLOG_MARK, APLOG_INFO, errno, r,
"client stopped connection before rvputs completed");
ap_bsetflag(r->connection->client, B_EOUT, 1);
r->connection->aborted = 1;
"client stopped connection before rvputs completed");
ap_bsetflag(r->connection->client, B_EOUT, 1);
r->connection->aborted = 1;
{
if (ap_bflush(r->connection->client) < 0) {
if (!ap_is_aborted(r->connection)) {
{
if (ap_bflush(r->connection->client) < 0) {
if (!ap_is_aborted(r->connection)) {
- ap_log_rerror(APLOG_MARK, APLOG_INFO, r,
+ ap_log_rerror(APLOG_MARK, APLOG_INFO, errno, r,
"client stopped connection before rflush completed");
ap_bsetflag(r->connection->client, B_EOUT, 1);
r->connection->aborted = 1;
"client stopped connection before rflush completed");
ap_bsetflag(r->connection->client, B_EOUT, 1);
r->connection->aborted = 1;
|| S_ISLNK(r->finfo.st_mode)) {
return OK;
}
|| S_ISLNK(r->finfo.st_mode)) {
return OK;
}
- ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, r,
+ ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, 0, r,
"object is not a file, directory or symlink: %s",
r->filename);
return HTTP_FORBIDDEN;
"object is not a file, directory or symlink: %s",
r->filename);
return HTTP_FORBIDDEN;
#if defined(EACCES) /* ZZZ again, AP error checking. */
if (errno != EACCES)
#endif
#if defined(EACCES) /* ZZZ again, AP error checking. */
if (errno != EACCES)
#endif
- ap_log_rerror(APLOG_MARK, APLOG_ERR, r,
+ ap_log_rerror(APLOG_MARK, APLOG_ERR, errno, r,
"access to %s failed", r->uri);
return HTTP_FORBIDDEN;
}
"access to %s failed", r->uri);
return HTTP_FORBIDDEN;
}
num_dirs = ap_count_dirs(test_filename);
if (!ap_os_is_filename_valid(r->filename)) {
num_dirs = ap_count_dirs(test_filename);
if (!ap_os_is_filename_valid(r->filename)) {
- ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, r,
+ ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, 0, r,
"Filename is not valid: %s", r->filename);
return HTTP_FORBIDDEN;
}
"Filename is not valid: %s", r->filename);
return HTTP_FORBIDDEN;
}
*/
if ((res = check_symlinks(test_dirname, core_dir->opts))) {
*/
if ((res = check_symlinks(test_dirname, core_dir->opts))) {
- ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, r,
+ ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, 0, r,
"Symbolic link not allowed: %s", test_dirname);
return res;
}
"Symbolic link not allowed: %s", test_dirname);
return res;
}
*/
if (!S_ISDIR(r->finfo.st_mode) /* ZZZ use AP funcs and defines */
&& (res = check_symlinks(r->filename, ap_allow_options(r)))) {
*/
if (!S_ISDIR(r->finfo.st_mode) /* ZZZ use AP funcs and defines */
&& (res = check_symlinks(r->filename, ap_allow_options(r)))) {
- ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, r,
+ ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, 0, r,
"Symbolic link not allowed: %s", r->filename);
return res;
}
"Symbolic link not allowed: %s", r->filename);
return res;
}
}
else {
if ((res = check_symlinks(rnew->filename, ap_allow_options(rnew)))) {
}
else {
if ((res = check_symlinks(rnew->filename, ap_allow_options(rnew)))) {
- ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, rnew,
+ ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, 0, rnew,
"Symbolic link not allowed: %s", rnew->filename);
rnew->status = res;
return rnew;
"Symbolic link not allowed: %s", rnew->filename);
rnew->status = res;
return rnew;
* dying with a recursive server error...
*/
recursive_error = SERVER_ERROR;
* dying with a recursive server error...
*/
recursive_error = SERVER_ERROR;
- ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, r,
+ ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, 0, r,
"Invalid error redirection directive: %s",
custom_response);
}
"Invalid error redirection directive: %s",
custom_response);
}
static void decl_die(int status, char *phase, request_rec *r)
{
if (status == DECLINED) {
static void decl_die(int status, char *phase, request_rec *r)
{
if (status == DECLINED) {
- ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_CRIT, r,
+ ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_CRIT, 0, r,
"configuration error: couldn't %s: %s", phase, r->uri);
ap_die(SERVER_ERROR, r);
}
"configuration error: couldn't %s: %s", phase, r->uri);
ap_die(SERVER_ERROR, r);
}
types_confname = ap_server_root_relative(p, types_confname);
if (!(f = ap_pcfg_openfile(p, types_confname))) {
types_confname = ap_server_root_relative(p, types_confname);
if (!(f = ap_pcfg_openfile(p, types_confname))) {
- ap_log_error(APLOG_MARK, APLOG_ERR, s,
+ ap_log_error(APLOG_MARK, APLOG_ERR, errno, s,
"could not open mime types log file %s.", types_confname);
exit(1);
}
"could not open mime types log file %s.", types_confname);
exit(1);
}
config_log_state *cls,
ap_array_header_t *default_format)
{
config_log_state *cls,
ap_array_header_t *default_format)
{
if (cls->log_fd != NULL) {
return cls; /* virtual config shared w/main server */
}
if (cls->log_fd != NULL) {
return cls; /* virtual config shared w/main server */
}
}
else {
const char *fname = ap_server_root_relative(p, cls->fname);
}
else {
const char *fname = ap_server_root_relative(p, cls->fname);
- if (ap_open(&cls->log_fd, fname, xfer_flags, xfer_mode, p) != APR_SUCCESS) {
- ap_log_error(APLOG_MARK, APLOG_ERR, s,
+ if ((status = ap_open(&cls->log_fd, fname, xfer_flags, xfer_mode, p))
+ != APR_SUCCESS) {
+ ap_log_error(APLOG_MARK, APLOG_ERR, status, s,
"could not open transfer log file %s.", fname);
exit(1);
}
"could not open transfer log file %s.", fname);
exit(1);
}
action ? action : ap_default_type(r)))) {
script = t;
if (r->finfo.st_mode == 0) {
action ? action : ap_default_type(r)))) {
script = t;
if (r->finfo.st_mode == 0) {
- ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, r,
+ ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, 0, r,
"File does not exist: %s", r->filename);
return NOT_FOUND;
}
"File does not exist: %s", r->filename);
return NOT_FOUND;
}
/* must be a relative URL to be combined with base */
if (strchr(base, '/') == NULL && (!strncmp(value, "../", 3)
|| !strcmp(value, ".."))) {
/* must be a relative URL to be combined with base */
if (strchr(base, '/') == NULL && (!strncmp(value, "../", 3)
|| !strcmp(value, ".."))) {
- ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, r,
+ ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, 0, r,
"invalid base directive in map file: %s", r->uri);
return NULL;
}
"invalid base directive in map file: %s", r->uri);
return NULL;
}
value */
}
else if (directory) {
value */
}
else if (directory) {
- ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, r,
+ ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, 0, r,
"invalid directory name in map file: %s", r->uri);
return NULL;
}
"invalid directory name in map file: %s", r->uri);
return NULL;
}
we failed. They lose! */
need_2_fields:
we failed. They lose! */
need_2_fields:
- ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, r,
+ ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, 0, r,
"map file %s, line %d syntax error: requires at "
"least two fields", r->uri, imap->line_number);
/* fall through */
"map file %s, line %d syntax error: requires at "
"least two fields", r->uri, imap->line_number);
/* fall through */
- ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, r,
+ ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, 0, r,
"Syntax error in type map --- no ':': %s", r->filename);
return NULL;
}
"Syntax error in type map --- no ':': %s", r->filename);
return NULL;
}
} while (*cp && ap_isspace(*cp));
if (!*cp) {
} while (*cp && ap_isspace(*cp));
if (!*cp) {
- ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, r,
+ ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, 0, r,
"Syntax error in type map --- no header body: %s",
r->filename);
return NULL;
"Syntax error in type map --- no header body: %s",
r->filename);
return NULL;
{
request_rec *r = neg->r;
ap_file_t *map;
{
request_rec *r = neg->r;
ap_file_t *map;
char buffer[MAX_STRING_LEN];
enum header_state hstate;
struct var_rec mime_info;
char buffer[MAX_STRING_LEN];
enum header_state hstate;
struct var_rec mime_info;
/* We are not using multiviews */
neg->count_multiviews_variants = 0;
/* We are not using multiviews */
neg->count_multiviews_variants = 0;
- if (ap_open(&map, rr->filename, APR_READ | APR_BUFFERED,
- APR_OS_DEFAULT, neg->pool) != APR_SUCCESS) {
- ap_log_rerror(APLOG_MARK, APLOG_ERR, r,
+ if ((status = ap_open(&map, rr->filename, APR_READ | APR_BUFFERED,
+ APR_OS_DEFAULT, neg->pool)) != APR_SUCCESS) {
+ ap_log_rerror(APLOG_MARK, APLOG_ERR, status, r,
"cannot access type map file: %s", rr->filename);
return HTTP_FORBIDDEN;
}
"cannot access type map file: %s", rr->filename);
return HTTP_FORBIDDEN;
}
char *filp;
int prefix_len;
ap_dir_t *dirp;
char *filp;
int prefix_len;
ap_dir_t *dirp;
struct var_rec mime_info;
struct accept_rec accept_info;
void *new_var;
struct var_rec mime_info;
struct accept_rec accept_info;
void *new_var;
++filp;
prefix_len = strlen(filp);
++filp;
prefix_len = strlen(filp);
- if (ap_opendir(&dirp, neg->dir_name, neg->pool) != APR_SUCCESS) {
- ap_log_rerror(APLOG_MARK, APLOG_ERR, r,
+ if ((status = ap_opendir(&dirp, neg->dir_name, neg->pool)) != APR_SUCCESS) {
+ ap_log_rerror(APLOG_MARK, APLOG_ERR, status, r,
"cannot read directory for multi: %s", neg->dir_name);
return HTTP_FORBIDDEN;
}
"cannot read directory for multi: %s", neg->dir_name);
return HTTP_FORBIDDEN;
}
- ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, r,
+ ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, 0, r,
"no acceptable variant: %s", r->filename);
return NOT_ACCEPTABLE;
}
"no acceptable variant: %s", r->filename);
return NOT_ACCEPTABLE;
}
uid_t uid = atoi(&unixd_config.user_name[1]);
if ((ent = getpwuid(uid)) == NULL) {
uid_t uid = atoi(&unixd_config.user_name[1]);
if ((ent = getpwuid(uid)) == NULL) {
- ap_log_error(APLOG_MARK, APLOG_ALERT, NULL,
+ ap_log_error(APLOG_MARK, APLOG_ALERT, errno, NULL,
"getpwuid: couldn't determine user name from uid %u, "
"you probably need to modify the User directive",
(unsigned)uid);
"getpwuid: couldn't determine user name from uid %u, "
"you probably need to modify the User directive",
(unsigned)uid);
* setgid() is known to zap the group list.
*/
if (setgid(unixd_config.group_id) == -1) {
* setgid() is known to zap the group list.
*/
if (setgid(unixd_config.group_id) == -1) {
- ap_log_error(APLOG_MARK, APLOG_ALERT, NULL,
+ ap_log_error(APLOG_MARK, APLOG_ALERT, errno, NULL,
"setgid: unable to set group id to Group %u",
(unsigned)unixd_config.group_id);
return -1;
"setgid: unable to set group id to Group %u",
(unsigned)unixd_config.group_id);
return -1;
/* Reset `groups' attributes. */
if (initgroups(name, unixd_config.group_id) == -1) {
/* Reset `groups' attributes. */
if (initgroups(name, unixd_config.group_id) == -1) {
- ap_log_error(APLOG_MARK, APLOG_ALERT, NULL,
+ ap_log_error(APLOG_MARK, APLOG_ALERT, errno, NULL,
"initgroups: unable to set groups for User %s "
"and Group %u", name, (unsigned)unixd_config.group_id);
return -1;
"initgroups: unable to set groups for User %s "
"and Group %u", name, (unsigned)unixd_config.group_id);
return -1;
GETPRIVMODE();
if (setuid(unixd_config.user_id) == -1) {
GETUSERMODE();
GETPRIVMODE();
if (setuid(unixd_config.user_id) == -1) {
GETUSERMODE();
- ap_log_error(APLOG_MARK, APLOG_ALERT, NULL,
+ ap_log_error(APLOG_MARK, APLOG_ALERT, errno, NULL,
"setuid: unable to change to uid: %ld",
(long) unixd_config.user_id);
exit(1);
"setuid: unable to change to uid: %ld",
(long) unixd_config.user_id);
exit(1);
os_init_job_environment(server_conf, unixd_config.user_name, one_process) != 0 ||
#endif
setuid(unixd_config.user_id) == -1)) {
os_init_job_environment(server_conf, unixd_config.user_name, one_process) != 0 ||
#endif
setuid(unixd_config.user_id) == -1)) {
- ap_log_error(APLOG_MARK, APLOG_ALERT, NULL,
+ ap_log_error(APLOG_MARK, APLOG_ALERT, errno, NULL,
"setuid: unable to change to uid: %ld",
(long) unixd_config.user_id);
return -1;
"setuid: unable to change to uid: %ld",
(long) unixd_config.user_id);
return -1;
}
if (result == HTTP_INTERNAL_SERVER_ERROR && r->handler && r->filename) {
}
if (result == HTTP_INTERNAL_SERVER_ERROR && r->handler && r->filename) {
- ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_WARNING, r,
+ ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_WARNING, 0, r,
"handler \"%s\" not found for: %s", r->handler, r->filename);
}
return HTTP_INTERNAL_SERVER_ERROR;
"handler \"%s\" not found for: %s", r->handler, r->filename);
}
return HTTP_INTERNAL_SERVER_ERROR;
}
if (!modp) {
/* Uh-oh, this module doesn't exist */
}
if (!modp) {
/* Uh-oh, this module doesn't exist */
- ap_log_error(APLOG_MARK, APLOG_ERR|APLOG_NOERRNO, NULL,
+ ap_log_error(APLOG_MARK, APLOG_ERR|APLOG_NOERRNO, 0, NULL,
"Cannot remove module %s: not found in module list",
m->name);
return;
"Cannot remove module %s: not found in module list",
m->name);
return;
ap_cfg_closefile(f);
if (errmsg) {
ap_cfg_closefile(f);
if (errmsg) {
- ap_log_rerror(APLOG_MARK, APLOG_ALERT|APLOG_NOERRNO, r,
+ ap_log_rerror(APLOG_MARK, APLOG_ALERT|APLOG_NOERRNO, 0, r,
"%s: %s", filename, errmsg);
return HTTP_INTERNAL_SERVER_ERROR;
}
"%s: %s", filename, errmsg);
return HTTP_INTERNAL_SERVER_ERROR;
}
break;
}
else if (errno != ENOENT && errno != ENOTDIR) {
break;
}
else if (errno != ENOENT && errno != ENOTDIR) {
- ap_log_rerror(APLOG_MARK, APLOG_CRIT, r,
+ ap_log_rerror(APLOG_MARK, APLOG_CRIT, errno, r,
"%s pcfg_openfile: unable to check htaccess file, "
"ensure it is readable",
filename);
"%s pcfg_openfile: unable to check htaccess file, "
"ensure it is readable",
filename);
stat = ap_setsocketopt(s, APR_SO_REUSEADDR, one);
if (stat != APR_SUCCESS && stat != APR_ENOTIMPL) {
stat = ap_setsocketopt(s, APR_SO_REUSEADDR, one);
if (stat != APR_SUCCESS && stat != APR_ENOTIMPL) {
- ap_log_error(APLOG_MARK, APLOG_CRIT, NULL,
+ ap_log_error(APLOG_MARK, APLOG_CRIT, stat, NULL,
"make_sock: for %s, setsockopt: (SO_REUSEADDR)", addr);
ap_close_socket(s);
return stat;
"make_sock: for %s, setsockopt: (SO_REUSEADDR)", addr);
ap_close_socket(s);
return stat;
stat = ap_setsocketopt(s, APR_SO_KEEPALIVE, one);
if (stat != APR_SUCCESS && stat != APR_ENOTIMPL) {
stat = ap_setsocketopt(s, APR_SO_KEEPALIVE, one);
if (stat != APR_SUCCESS && stat != APR_ENOTIMPL) {
- ap_log_error(APLOG_MARK, APLOG_CRIT, NULL,
+ ap_log_error(APLOG_MARK, APLOG_CRIT, stat, NULL,
"make_sock: for %s, setsockopt: (SO_KEEPALIVE)", addr);
ap_close_socket(s);
return stat;
"make_sock: for %s, setsockopt: (SO_KEEPALIVE)", addr);
ap_close_socket(s);
return stat;
if (send_buffer_size) {
stat = ap_setsocketopt(s, APR_SO_SNDBUF, send_buffer_size);
if (stat != APR_SUCCESS && stat != APR_ENOTIMPL) {
if (send_buffer_size) {
stat = ap_setsocketopt(s, APR_SO_SNDBUF, send_buffer_size);
if (stat != APR_SUCCESS && stat != APR_ENOTIMPL) {
- ap_log_error(APLOG_MARK, APLOG_WARNING, NULL,
+ ap_log_error(APLOG_MARK, APLOG_WARNING, stat, NULL,
"make_sock: failed to set SendBufferSize for %s, "
"using default", addr);
/* not a fatal error */
"make_sock: failed to set SendBufferSize for %s, "
"using default", addr);
/* not a fatal error */
}
if ((stat = ap_bind(s)) != APR_SUCCESS) {
}
if ((stat = ap_bind(s)) != APR_SUCCESS) {
- ap_log_error(APLOG_MARK, APLOG_CRIT, NULL,
+ ap_log_error(APLOG_MARK, APLOG_CRIT, stat, NULL,
"make_sock: could not bind to %s", addr);
ap_close_socket(s);
return stat;
}
if ((stat = ap_listen(s, ap_listenbacklog)) != APR_SUCCESS) {
"make_sock: could not bind to %s", addr);
ap_close_socket(s);
return stat;
}
if ((stat = ap_listen(s, ap_listenbacklog)) != APR_SUCCESS) {
- ap_log_error(APLOG_MARK, APLOG_ERR, NULL,
+ ap_log_error(APLOG_MARK, APLOG_ERR, stat, NULL,
"make_sock: unable to listen for connections on %s", addr);
ap_close_socket(s);
return stat;
"make_sock: unable to listen for connections on %s", addr);
ap_close_socket(s);
return stat;
{
ap_listen_rec **walk;
ap_listen_rec *new;
{
ap_listen_rec **walk;
ap_listen_rec *new;
char oldaddr[17];
unsigned int oldport;
char oldaddr[17];
unsigned int oldport;
/* XXX - We need to deal with freeing this structure properly. */
new = ap_palloc(process->pool, sizeof(ap_listen_rec));
new->active = 0;
/* XXX - We need to deal with freeing this structure properly. */
new = ap_palloc(process->pool, sizeof(ap_listen_rec));
new->active = 0;
- if (ap_create_tcp_socket(&new->sd, NULL) != APR_SUCCESS) {
- ap_log_error(APLOG_MARK, APLOG_CRIT, NULL,
+ if ((status = ap_create_tcp_socket(&new->sd, NULL)) != APR_SUCCESS) {
+ ap_log_error(APLOG_MARK, APLOG_CRIT, status, NULL,
"make_sock: failed to get a socket for %s", addr);
return;
}
"make_sock: failed to get a socket for %s", addr);
return;
}
fflush(stderr);
ap_get_os_file(&errfile, s_main->error_log);
if (dup2(errfile, STDERR_FILENO) == -1) {
fflush(stderr);
ap_get_os_file(&errfile, s_main->error_log);
if (dup2(errfile, STDERR_FILENO) == -1) {
- ap_log_error(APLOG_MARK, APLOG_CRIT, s_main,
+ ap_log_error(APLOG_MARK, APLOG_CRIT, errno, s_main,
"unable to replace stderr with error_log");
} else {
replace_stderr = 0;
"unable to replace stderr with error_log");
} else {
replace_stderr = 0;
* of the submitter.
*/
if (replace_stderr && freopen("/dev/null", "w", stderr) == NULL) {
* of the submitter.
*/
if (replace_stderr && freopen("/dev/null", "w", stderr) == NULL) {
- ap_log_error(APLOG_MARK, APLOG_CRIT, s_main,
+ ap_log_error(APLOG_MARK, APLOG_CRIT, errno, s_main,
"unable to replace stderr with /dev/null");
}
"unable to replace stderr with /dev/null");
}
dup2(errfile, STDERR_FILENO);
}
dup2(errfile, STDERR_FILENO);
}
-static void log_error_core(const char *file, int line, int level,
- const server_rec *s, const request_rec *r,
- const char *fmt, va_list args)
+static void log_error_core(const char *file, int line, int level,
+ ap_status_t status, const server_rec *s,
+ const request_rec *r, const char *fmt, va_list args)
{
char errstr[MAX_STRING_LEN];
size_t len;
{
char errstr[MAX_STRING_LEN];
size_t len;
- /* change to AP errno funcs. */
- int save_errno = errno;
ap_file_t *logf = NULL;
int errfileno = STDERR_FILENO;
ap_file_t *logf = NULL;
int errfileno = STDERR_FILENO;
"[client %s] ", r->connection->remote_ip);
}
if (!(level & APLOG_NOERRNO)
"[client %s] ", r->connection->remote_ip);
}
if (!(level & APLOG_NOERRNO)
#ifdef WIN32
&& !(level & APLOG_WIN32ERROR)
#endif
) {
#ifdef WIN32
&& !(level & APLOG_WIN32ERROR)
#endif
) {
- /* ZZZ use AP funcs to set the errno and the error string. */
len += ap_snprintf(errstr + len, sizeof(errstr) - len,
len += ap_snprintf(errstr + len, sizeof(errstr) - len,
- "(%d)%s: ", save_errno, strerror(save_errno));
+ "(%d)%s: ", status, strerror(status));
}
#ifdef WIN32
if (level & APLOG_WIN32ERROR) {
}
#ifdef WIN32
if (level & APLOG_WIN32ERROR) {
}
API_EXPORT(void) ap_log_error(const char *file, int line, int level,
}
API_EXPORT(void) ap_log_error(const char *file, int line, int level,
- const server_rec *s, const char *fmt, ...)
+ ap_status_t status, const server_rec *s,
+ const char *fmt, ...)
{
va_list args;
va_start(args, fmt);
{
va_list args;
va_start(args, fmt);
- log_error_core(file, line, level, s, NULL, fmt, args);
+ log_error_core(file, line, level, status, s, NULL, fmt, args);
va_end(args);
}
API_EXPORT(void) ap_log_rerror(const char *file, int line, int level,
va_end(args);
}
API_EXPORT(void) ap_log_rerror(const char *file, int line, int level,
- const request_rec *r, const char *fmt, ...)
+ ap_status_t status, const request_rec *r,
+ const char *fmt, ...)
{
va_list args;
va_start(args, fmt);
{
va_list args;
va_start(args, fmt);
- log_error_core(file, line, level, r->server, r, fmt, args);
+ log_error_core(file, line, level, status, r->server, r, fmt, args);
/*
* IF the error level is 'warning' or more severe,
* AND there isn't already error text associated with this request,
/*
* IF the error level is 'warning' or more severe,
* AND there isn't already error text associated with this request,
* that may screw up scripts written to do something
* based on the last modification time of the pid file.
*/
* that may screw up scripts written to do something
* based on the last modification time of the pid file.
*/
- ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_WARNING, NULL,
+ ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_WARNING, 0, NULL,
ap_psprintf(p,
"pid file %s overwritten -- Unclean shutdown of previous Apache run?",
fname)
ap_psprintf(p,
"pid file %s overwritten -- Unclean shutdown of previous Apache run?",
fname)
API_EXPORT(void) ap_log_error_old(const char *err, server_rec *s)
{
API_EXPORT(void) ap_log_error_old(const char *err, server_rec *s)
{
- ap_log_error(APLOG_MARK, APLOG_ERR, s, "%s", err);
+ ap_log_error(APLOG_MARK, APLOG_ERR, errno, s, "%s", err);
}
API_EXPORT(void) ap_log_unixerr(const char *routine, const char *file,
const char *msg, server_rec *s)
{
}
API_EXPORT(void) ap_log_unixerr(const char *routine, const char *file,
const char *msg, server_rec *s)
{
- ap_log_error(file, 0, APLOG_ERR, s, "%s", msg);
+ ap_log_error(file, 0, APLOG_ERR, errno, s, "%s", msg);
}
API_EXPORT(void) ap_log_printf(const server_rec *s, const char *fmt, ...)
}
API_EXPORT(void) ap_log_printf(const server_rec *s, const char *fmt, ...)
va_list args;
va_start(args, fmt);
va_list args;
va_start(args, fmt);
- log_error_core(APLOG_MARK, APLOG_ERR, s, NULL, fmt, args);
+ log_error_core(APLOG_MARK, APLOG_ERR, errno, s, NULL, fmt, args);
va_end(args);
}
API_EXPORT(void) ap_log_reason(const char *reason, const char *file, request_rec *r)
{
va_end(args);
}
API_EXPORT(void) ap_log_reason(const char *reason, const char *file, request_rec *r)
{
- ap_log_error(APLOG_MARK, APLOG_ERR, r->server,
+ ap_log_error(APLOG_MARK, APLOG_ERR, errno, r->server,
"access to %s failed for %s, reason: %s",
file,
ap_get_remote_host(r->connection, r->per_dir_config, REMOTE_NAME),
"access to %s failed for %s, reason: %s",
file,
ap_get_remote_host(r->connection, r->per_dir_config, REMOTE_NAME),
case 7: /* 1.4sec */
/* ok, now it's being annoying */
ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_WARNING,
case 7: /* 1.4sec */
/* ok, now it's being annoying */
ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_WARNING,
"child process %d still did not exit, sending a SIGTERM",
pid);
kill(pid, SIGTERM);
break;
case 8: /* 6 sec */
/* die child scum */
"child process %d still did not exit, sending a SIGTERM",
pid);
kill(pid, SIGTERM);
break;
case 8: /* 6 sec */
/* die child scum */
- ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, server_conf,
+ ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, 0, server_conf,
"child process %d still did not exit, sending a SIGKILL",
pid);
kill(pid, SIGKILL);
"child process %d still did not exit, sending a SIGKILL",
pid);
kill(pid, SIGKILL);
* exited, we will likely fail to bind to the port
* after the restart.
*/
* exited, we will likely fail to bind to the port
* after the restart.
*/
- ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, server_conf,
+ ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, 0, server_conf,
"could not make child process %d exit, "
"attempting to continue anyway", pid);
break;
"could not make child process %d exit, "
"attempting to continue anyway", pid);
break;
sa.sa_flags = SA_RESETHAND;
#endif
if (sigaction(SIGSEGV, &sa, NULL) < 0)
sa.sa_flags = SA_RESETHAND;
#endif
if (sigaction(SIGSEGV, &sa, NULL) < 0)
- ap_log_error(APLOG_MARK, APLOG_WARNING, server_conf, "sigaction(SIGSEGV)");
+ ap_log_error(APLOG_MARK, APLOG_WARNING, errno, server_conf, "sigaction(SIGSEGV)");
#ifdef SIGBUS
if (sigaction(SIGBUS, &sa, NULL) < 0)
#ifdef SIGBUS
if (sigaction(SIGBUS, &sa, NULL) < 0)
- ap_log_error(APLOG_MARK, APLOG_WARNING, server_conf, "sigaction(SIGBUS)");
+ ap_log_error(APLOG_MARK, APLOG_WARNING, errno, server_conf, "sigaction(SIGBUS)");
#endif
#ifdef SIGABORT
if (sigaction(SIGABORT, &sa, NULL) < 0)
#endif
#ifdef SIGABORT
if (sigaction(SIGABORT, &sa, NULL) < 0)
- ap_log_error(APLOG_MARK, APLOG_WARNING, server_conf, "sigaction(SIGABORT)");
+ ap_log_error(APLOG_MARK, APLOG_WARNING, errno, server_conf, "sigaction(SIGABORT)");
#endif
#ifdef SIGABRT
if (sigaction(SIGABRT, &sa, NULL) < 0)
#endif
#ifdef SIGABRT
if (sigaction(SIGABRT, &sa, NULL) < 0)
- ap_log_error(APLOG_MARK, APLOG_WARNING, server_conf, "sigaction(SIGABRT)");
+ ap_log_error(APLOG_MARK, APLOG_WARNING, errno, server_conf, "sigaction(SIGABRT)");
#endif
#ifdef SIGILL
if (sigaction(SIGILL, &sa, NULL) < 0)
#endif
#ifdef SIGILL
if (sigaction(SIGILL, &sa, NULL) < 0)
- ap_log_error(APLOG_MARK, APLOG_WARNING, server_conf, "sigaction(SIGILL)");
+ ap_log_error(APLOG_MARK, APLOG_WARNING, errno, server_conf, "sigaction(SIGILL)");
#endif
sa.sa_flags = 0;
}
sa.sa_handler = sig_term;
if (sigaction(SIGTERM, &sa, NULL) < 0)
#endif
sa.sa_flags = 0;
}
sa.sa_handler = sig_term;
if (sigaction(SIGTERM, &sa, NULL) < 0)
- ap_log_error(APLOG_MARK, APLOG_WARNING, server_conf, "sigaction(SIGTERM)");
+ ap_log_error(APLOG_MARK, APLOG_WARNING, errno, server_conf, "sigaction(SIGTERM)");
#ifdef SIGINT
if (sigaction(SIGINT, &sa, NULL) < 0)
#ifdef SIGINT
if (sigaction(SIGINT, &sa, NULL) < 0)
- ap_log_error(APLOG_MARK, APLOG_WARNING, server_conf, "sigaction(SIGINT)");
+ ap_log_error(APLOG_MARK, APLOG_WARNING, errno, server_conf, "sigaction(SIGINT)");
#endif
#ifdef SIGXCPU
sa.sa_handler = SIG_DFL;
if (sigaction(SIGXCPU, &sa, NULL) < 0)
#endif
#ifdef SIGXCPU
sa.sa_handler = SIG_DFL;
if (sigaction(SIGXCPU, &sa, NULL) < 0)
- ap_log_error(APLOG_MARK, APLOG_WARNING, server_conf, "sigaction(SIGXCPU)");
+ ap_log_error(APLOG_MARK, APLOG_WARNING, errno, server_conf, "sigaction(SIGXCPU)");
#endif
#ifdef SIGXFSZ
sa.sa_handler = SIG_DFL;
if (sigaction(SIGXFSZ, &sa, NULL) < 0)
#endif
#ifdef SIGXFSZ
sa.sa_handler = SIG_DFL;
if (sigaction(SIGXFSZ, &sa, NULL) < 0)
- ap_log_error(APLOG_MARK, APLOG_WARNING, server_conf, "sigaction(SIGXFSZ)");
+ ap_log_error(APLOG_MARK, APLOG_WARNING, errno, server_conf, "sigaction(SIGXFSZ)");
#endif
#ifdef SIGPIPE
sa.sa_handler = SIG_IGN;
if (sigaction(SIGPIPE, &sa, NULL) < 0)
#endif
#ifdef SIGPIPE
sa.sa_handler = SIG_IGN;
if (sigaction(SIGPIPE, &sa, NULL) < 0)
- ap_log_error(APLOG_MARK, APLOG_WARNING, server_conf, "sigaction(SIGPIPE)");
+ ap_log_error(APLOG_MARK, APLOG_WARNING, errno, server_conf, "sigaction(SIGPIPE)");
#endif
/* we want to ignore HUPs and WINCH while we're busy processing one */
#endif
/* we want to ignore HUPs and WINCH while we're busy processing one */
sigaddset(&sa.sa_mask, SIGWINCH);
sa.sa_handler = restart;
if (sigaction(SIGHUP, &sa, NULL) < 0)
sigaddset(&sa.sa_mask, SIGWINCH);
sa.sa_handler = restart;
if (sigaction(SIGHUP, &sa, NULL) < 0)
- ap_log_error(APLOG_MARK, APLOG_WARNING, server_conf, "sigaction(SIGHUP)");
+ ap_log_error(APLOG_MARK, APLOG_WARNING, errno, server_conf, "sigaction(SIGHUP)");
if (sigaction(SIGWINCH, &sa, NULL) < 0)
if (sigaction(SIGWINCH, &sa, NULL) < 0)
- ap_log_error(APLOG_MARK, APLOG_WARNING, server_conf, "sigaction(SIGWINCH)");
+ ap_log_error(APLOG_MARK, APLOG_WARNING, errno, server_conf, "sigaction(SIGWINCH)");
#else
if (!one_process) {
signal(SIGSEGV, sig_coredump);
#else
if (!one_process) {
signal(SIGSEGV, sig_coredump);
*/
if ((WIFEXITED(status)) &&
WEXITSTATUS(status) == APEXIT_CHILDFATAL) {
*/
if ((WIFEXITED(status)) &&
WEXITSTATUS(status) == APEXIT_CHILDFATAL) {
- ap_log_error(APLOG_MARK, APLOG_ALERT|APLOG_NOERRNO, server_conf,
+ ap_log_error(APLOG_MARK, APLOG_ALERT|APLOG_NOERRNO, 0, server_conf,
"Child %d returned a Fatal error... \n"
"Apache is exiting!",
pid);
"Child %d returned a Fatal error... \n"
"Apache is exiting!",
pid);
#ifdef WCOREDUMP
if (WCOREDUMP(status)) {
ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_NOTICE,
#ifdef WCOREDUMP
if (WCOREDUMP(status)) {
ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_NOTICE,
"child pid %d exit signal %s (%d), "
"possible coredump in %s",
pid, (WTERMSIG(status) >= NumSIG) ? "" :
"child pid %d exit signal %s (%d), "
"possible coredump in %s",
pid, (WTERMSIG(status) >= NumSIG) ? "" :
else {
#endif
ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_NOTICE,
else {
#endif
ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_NOTICE,
"child pid %d exit signal %s (%d)", pid,
SYS_SIGLIST[WTERMSIG(status)], WTERMSIG(status));
#ifdef WCOREDUMP
"child pid %d exit signal %s (%d)", pid,
SYS_SIGLIST[WTERMSIG(status)], WTERMSIG(status));
#ifdef WCOREDUMP
if (setsockopt(s, IPPROTO_TCP, TCP_NODELAY, (char *) &just_say_no,
sizeof(int)) < 0) {
if (setsockopt(s, IPPROTO_TCP, TCP_NODELAY, (char *) &just_say_no,
sizeof(int)) < 0) {
- ap_log_error(APLOG_MARK, APLOG_WARNING, server_conf,
+ ap_log_error(APLOG_MARK, APLOG_WARNING, errno, server_conf,
"setsockopt: (TCP_NODELAY)");
}
}
"setsockopt: (TCP_NODELAY)");
}
}
long conn_id = my_child_num * HARD_THREAD_LIMIT + my_thread_num;
if (getsockname(csd, &sa_server, &len) < 0) {
long conn_id = my_child_num * HARD_THREAD_LIMIT + my_thread_num;
if (getsockname(csd, &sa_server, &len) < 0) {
- ap_log_error(APLOG_MARK, APLOG_ERR, server_conf, "getsockname");
+ ap_log_error(APLOG_MARK, APLOG_ERR, errno, server_conf, "getsockname");
iol = unix_attach_socket(csd);
if (iol == NULL) {
if (errno == EBADF) {
iol = unix_attach_socket(csd);
if (iol == NULL) {
if (errno == EBADF) {
- ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_WARNING, NULL,
+ ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_WARNING, 0, NULL,
"filedescriptor (%u) larger than FD_SETSIZE (%u) "
"found, you probably need to rebuild Apache with a "
"larger FD_SETSIZE", csd, FD_SETSIZE);
}
else {
"filedescriptor (%u) larger than FD_SETSIZE (%u) "
"found, you probably need to rebuild Apache with a "
"larger FD_SETSIZE", csd, FD_SETSIZE);
}
else {
- ap_log_error(APLOG_MARK, APLOG_WARNING, NULL,
+ ap_log_error(APLOG_MARK, APLOG_WARNING, errno, NULL,
"error attaching to socket");
}
close(csd);
"error attaching to socket");
}
close(csd);
/* poll() will only return errors in catastrophic
* circumstances. Let's try exiting gracefully, for now. */
/* poll() will only return errors in catastrophic
* circumstances. Let's try exiting gracefully, for now. */
- ap_log_error(APLOG_MARK, APLOG_ERR, (const server_rec *)
+ ap_log_error(APLOG_MARK, APLOG_ERR, errno, (const server_rec *)
ap_get_server_conf(), "poll: (listen)");
workers_may_exit = 1;
}
ap_get_server_conf(), "poll: (listen)");
workers_may_exit = 1;
}
sigfillset(&sig_mask);
if (pthread_sigmask(SIG_SETMASK, &sig_mask, NULL) != 0) {
sigfillset(&sig_mask);
if (pthread_sigmask(SIG_SETMASK, &sig_mask, NULL) != 0) {
- ap_log_error(APLOG_MARK, APLOG_ALERT, server_conf, "pthread_sigmask");
+ ap_log_error(APLOG_MARK, APLOG_ALERT, errno, server_conf, "pthread_sigmask");
}
requests_this_child = ap_max_requests_per_child;
}
requests_this_child = ap_max_requests_per_child;
my_info = (proc_info *)malloc(sizeof(proc_info));
if (my_info == NULL) {
my_info = (proc_info *)malloc(sizeof(proc_info));
if (my_info == NULL) {
- ap_log_error(APLOG_MARK, APLOG_ALERT, server_conf,
+ ap_log_error(APLOG_MARK, APLOG_ALERT, errno, server_conf,
"malloc: out of memory");
clean_child_exit(APEXIT_CHILDFATAL);
}
"malloc: out of memory");
clean_child_exit(APEXIT_CHILDFATAL);
}
(request_rec *) NULL);
#ifndef NO_THREADS
if (pthread_create(&thread, &thread_attr, worker_thread, my_info)) {
(request_rec *) NULL);
#ifndef NO_THREADS
if (pthread_create(&thread, &thread_attr, worker_thread, my_info)) {
- ap_log_error(APLOG_MARK, APLOG_ALERT, server_conf,
+ ap_log_error(APLOG_MARK, APLOG_ALERT, errno, server_conf,
"pthread_create: unable to create worker thread");
/* In case system resources are maxxed out, we don't want
Apache running away with the CPU trying to fork over and
"pthread_create: unable to create worker thread");
/* In case system resources are maxxed out, we don't want
Apache running away with the CPU trying to fork over and
just_die(signal_received);
break;
default:
just_die(signal_received);
break;
default:
- ap_log_error(APLOG_MARK, APLOG_ALERT, server_conf,
+ ap_log_error(APLOG_MARK, APLOG_ALERT, errno, server_conf,
"received impossible signal: %d", signal_received);
just_die(SIGTERM);
}
"received impossible signal: %d", signal_received);
just_die(SIGTERM);
}
}
if ((pid = fork()) == -1) {
}
if ((pid = fork()) == -1) {
- ap_log_error(APLOG_MARK, APLOG_ERR, s, "fork: Unable to fork new process");
+ ap_log_error(APLOG_MARK, APLOG_ERR, errno, s, "fork: Unable to fork new process");
/* In case system resources are maxxed out, we don't want
Apache running away with the CPU trying to fork over and
over and over again. */
/* In case system resources are maxxed out, we don't want
Apache running away with the CPU trying to fork over and
over and over again. */
/* Kill off one child */
char char_of_death = '!';
if (write(pipe_of_death[1], &char_of_death, 1) == -1) {
/* Kill off one child */
char char_of_death = '!';
if (write(pipe_of_death[1], &char_of_death, 1) == -1) {
- ap_log_error(APLOG_MARK, APLOG_WARNING, server_conf, "write pipe_of_death");
+ ap_log_error(APLOG_MARK, APLOG_WARNING, errno, server_conf, "write pipe_of_death");
static int reported = 0;
if (!reported) {
static int reported = 0;
if (!reported) {
- ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, server_conf,
+ ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, 0, server_conf,
"server reached MaxClients setting, consider"
" raising the MaxClients setting");
reported = 1;
"server reached MaxClients setting, consider"
" raising the MaxClients setting");
reported = 1;
/* ZZZZ */
if (idle_spawn_rate >= 8) {
/* ZZZZ */
if (idle_spawn_rate >= 8) {
- ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_INFO, server_conf,
+ ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_INFO, 0, server_conf,
"server seems busy, (you may need "
"to increase StartServers, ThreadsPerChild "
"or Min/MaxSparetThreads), "
"server seems busy, (you may need "
"to increase StartServers, ThreadsPerChild "
"or Min/MaxSparetThreads), "
* scoreboard. Somehow we don't know about this
* child.
*/
* scoreboard. Somehow we don't know about this
* child.
*/
- ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_WARNING, server_conf,
+ ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_WARNING, 0, server_conf,
"long lost child came home! (pid %d)", pid);
}
/* Don't perform idle maintenance when a child dies,
"long lost child came home! (pid %d)", pid);
}
/* Don't perform idle maintenance when a child dies,
pconf = _pconf;
server_conf = s;
if (pipe(pipe_of_death) == -1) {
pconf = _pconf;
server_conf = s;
if (pipe(pipe_of_death) == -1) {
- ap_log_error(APLOG_MARK, APLOG_ERR,
+ ap_log_error(APLOG_MARK, APLOG_ERR, errno,
(const server_rec*) server_conf,
"pipe: (pipe_of_death)");
exit(1);
(const server_rec*) server_conf,
"pipe: (pipe_of_death)");
exit(1);
*/
if (fcntl(pipe_of_death[0], F_SETFD, O_NONBLOCK) == -1) {
*/
if (fcntl(pipe_of_death[0], F_SETFD, O_NONBLOCK) == -1) {
- ap_log_error(APLOG_MARK, APLOG_ERR,
+ ap_log_error(APLOG_MARK, APLOG_ERR, errno,
(const server_rec*) server_conf,
"fcntl: O_NONBLOCKing (pipe_of_death)");
exit(1);
(const server_rec*) server_conf,
"fcntl: O_NONBLOCKing (pipe_of_death)");
exit(1);
server_conf = s;
if ((num_listensocks = setup_listeners(server_conf)) < 1) {
/* XXX: hey, what's the right way for the mpm to indicate a fatal error? */
server_conf = s;
if ((num_listensocks = setup_listeners(server_conf)) < 1) {
/* XXX: hey, what's the right way for the mpm to indicate a fatal error? */
- ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_ALERT, s,
+ ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_ALERT, 0, s,
"no listening sockets available, shutting down");
return 1;
}
"no listening sockets available, shutting down");
return 1;
}
hold_off_on_exponential_spawning = 10;
}
hold_off_on_exponential_spawning = 10;
}
- ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_NOTICE, server_conf,
+ ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_NOTICE, 0, server_conf,
"%s configured -- resuming normal operations",
ap_get_server_version());
"%s configured -- resuming normal operations",
ap_get_server_version());
- ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_INFO, server_conf,
+ ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_INFO, 0, server_conf,
"Server built: %s", ap_get_server_built());
restart_pending = shutdown_pending = 0;
"Server built: %s", ap_get_server_built());
restart_pending = shutdown_pending = 0;
* Kill child processes, tell them to call child_exit, etc...
*/
if (ap_killpg(getpgrp(), SIGTERM) < 0) {
* Kill child processes, tell them to call child_exit, etc...
*/
if (ap_killpg(getpgrp(), SIGTERM) < 0) {
- ap_log_error(APLOG_MARK, APLOG_WARNING, server_conf, "killpg SIGTERM");
+ ap_log_error(APLOG_MARK, APLOG_WARNING, errno, server_conf, "killpg SIGTERM");
}
reclaim_child_processes(1); /* Start with SIGTERM */
}
reclaim_child_processes(1); /* Start with SIGTERM */
const char *pidfile = NULL;
pidfile = ap_server_root_relative (pconf, ap_pid_fname);
if ( pidfile != NULL && unlink(pidfile) == 0)
const char *pidfile = NULL;
pidfile = ap_server_root_relative (pconf, ap_pid_fname);
if ( pidfile != NULL && unlink(pidfile) == 0)
- ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_INFO,
+ ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_INFO, 0,
server_conf,
"removed PID file %s (pid=%ld)",
pidfile, (long)getpid());
}
server_conf,
"removed PID file %s (pid=%ld)",
pidfile, (long)getpid());
}
- ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_NOTICE, server_conf,
+ ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_NOTICE, 0, server_conf,
"caught SIGTERM, shutting down");
return 1;
"caught SIGTERM, shutting down");
return 1;
int i, j;
char char_of_death = '!';
int i, j;
char char_of_death = '!';
- ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_NOTICE, server_conf,
+ ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_NOTICE, 0, server_conf,
"SIGWINCH received. Doing graceful restart");
/* give the children the signal to die */
for (i = 0; i < ap_daemons_limit;) {
if (write(pipe_of_death[1], &char_of_death, 1) == -1) {
if (errno == EINTR) continue;
"SIGWINCH received. Doing graceful restart");
/* give the children the signal to die */
for (i = 0; i < ap_daemons_limit;) {
if (write(pipe_of_death[1], &char_of_death, 1) == -1) {
if (errno == EINTR) continue;
- ap_log_error(APLOG_MARK, APLOG_WARNING, server_conf, "write pipe_of_death");
+ ap_log_error(APLOG_MARK, APLOG_WARNING, errno, server_conf, "write pipe_of_death");
* pthreads are stealing signals from us left and right.
*/
if (ap_killpg(getpgrp(), SIGTERM) < 0) {
* pthreads are stealing signals from us left and right.
*/
if (ap_killpg(getpgrp(), SIGTERM) < 0) {
- ap_log_error(APLOG_MARK, APLOG_WARNING, server_conf, "killpg SIGTERM");
+ ap_log_error(APLOG_MARK, APLOG_WARNING, errno, server_conf, "killpg SIGTERM");
}
reclaim_child_processes(1); /* Start with SIGTERM */
}
reclaim_child_processes(1); /* Start with SIGTERM */
- ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_NOTICE, server_conf,
+ ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_NOTICE, 0, server_conf,
"SIGHUP received. Attempting to restart");
}
if (!is_graceful) {
"SIGHUP received. Attempting to restart");
}
if (!is_graceful) {
if ((shmid = shmget(shmkey, SCOREBOARD_SIZE, IPC_CREAT | SHM_R | SHM_W)) == -1) {
#ifdef LINUX
if (errno == ENOSYS) {
if ((shmid = shmget(shmkey, SCOREBOARD_SIZE, IPC_CREAT | SHM_R | SHM_W)) == -1) {
#ifdef LINUX
if (errno == ENOSYS) {
- ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_EMERG, server_conf,
+ ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_EMERG, 0, server_conf,
"Your kernel was built without CONFIG_SYSVIPC\n"
"%s: Please consult the Apache FAQ for details",
ap_server_argv0);
}
#endif
"Your kernel was built without CONFIG_SYSVIPC\n"
"%s: Please consult the Apache FAQ for details",
ap_server_argv0);
}
#endif
- ap_log_error(APLOG_MARK, APLOG_EMERG, server_conf,
+ ap_log_error(APLOG_MARK, APLOG_EMERG, errno, server_conf,
"could not call shmget");
exit(APEXIT_INIT);
}
"could not call shmget");
exit(APEXIT_INIT);
}
- ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_INFO, server_conf,
+ ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_INFO, 0, server_conf,
"created shared memory segment #%d", shmid);
#ifdef MOVEBREAK
"created shared memory segment #%d", shmid);
#ifdef MOVEBREAK
#define BADSHMAT ((scoreboard *)(-1))
if ((ap_scoreboard_image = (scoreboard *) shmat(shmid, 0, 0)) == BADSHMAT) {
#define BADSHMAT ((scoreboard *)(-1))
if ((ap_scoreboard_image = (scoreboard *) shmat(shmid, 0, 0)) == BADSHMAT) {
- ap_log_error(APLOG_MARK, APLOG_EMERG, server_conf, "shmat error");
+ ap_log_error(APLOG_MARK, APLOG_EMERG, errno, server_conf, "shmat error");
/*
* We exit below, after we try to remove the segment
*/
}
else { /* only worry about permissions if we attached the segment */
if (shmctl(shmid, IPC_STAT, &shmbuf) != 0) {
/*
* We exit below, after we try to remove the segment
*/
}
else { /* only worry about permissions if we attached the segment */
if (shmctl(shmid, IPC_STAT, &shmbuf) != 0) {
- ap_log_error(APLOG_MARK, APLOG_ERR, server_conf,
+ ap_log_error(APLOG_MARK, APLOG_ERR, errno, server_conf,
"shmctl() could not stat segment #%d", shmid);
}
else {
shmbuf.shm_perm.uid = unixd_config.user_id;
shmbuf.shm_perm.gid = unixd_config.group_id;
if (shmctl(shmid, IPC_SET, &shmbuf) != 0) {
"shmctl() could not stat segment #%d", shmid);
}
else {
shmbuf.shm_perm.uid = unixd_config.user_id;
shmbuf.shm_perm.gid = unixd_config.group_id;
if (shmctl(shmid, IPC_SET, &shmbuf) != 0) {
- ap_log_error(APLOG_MARK, APLOG_ERR, server_conf,
+ ap_log_error(APLOG_MARK, APLOG_ERR, errno, server_conf,
"shmctl() could not set segment #%d", shmid);
}
}
"shmctl() could not set segment #%d", shmid);
}
}
* (small) tables.
*/
if (shmctl(shmid, IPC_RMID, NULL) != 0) {
* (small) tables.
*/
if (shmctl(shmid, IPC_RMID, NULL) != 0) {
- ap_log_error(APLOG_MARK, APLOG_WARNING, server_conf,
+ ap_log_error(APLOG_MARK, APLOG_WARNING, errno, server_conf,
"shmctl: IPC_RMID: could not remove shared memory segment #%d",
shmid);
}
"shmctl: IPC_RMID: could not remove shared memory segment #%d",
shmid);
}
- ap_log_error(APLOG_MARK, APLOG_EMERG, server_conf,
+ ap_log_error(APLOG_MARK, APLOG_EMERG, errno, server_conf,
"fcntl: F_SETLKW: Error getting accept lock, exiting! "
"Perhaps you need to use the LockFile directive to place "
"your lock file on a local disk!");
"fcntl: F_SETLKW: Error getting accept lock, exiting! "
"Perhaps you need to use the LockFile directive to place "
"your lock file on a local disk!");
/* nop */
}
if (ret < 0) {
/* nop */
}
if (ret < 0) {
- ap_log_error(APLOG_MARK, APLOG_EMERG, server_conf,
+ ap_log_error(APLOG_MARK, APLOG_EMERG, errno, server_conf,
"fcntl: F_SETLKW: Error freeing accept lock, exiting! "
"Perhaps you need to use the LockFile directive to place "
"your lock file on a local disk!");
"fcntl: F_SETLKW: Error freeing accept lock, exiting! "
"Perhaps you need to use the LockFile directive to place "
"your lock file on a local disk!");
if ((shmid = shmget(shmkey, SCOREBOARD_SIZE, IPC_CREAT | SHM_R | SHM_W)) == -1) {
#ifdef LINUX
if (errno == ENOSYS) {
if ((shmid = shmget(shmkey, SCOREBOARD_SIZE, IPC_CREAT | SHM_R | SHM_W)) == -1) {
#ifdef LINUX
if (errno == ENOSYS) {
- ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_EMERG, server_conf,
+ ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_EMERG, 0, server_conf,
"Your kernel was built without CONFIG_SYSVIPC\n"
"%s: Please consult the Apache FAQ for details",
ap_server_argv0);
}
#endif
"Your kernel was built without CONFIG_SYSVIPC\n"
"%s: Please consult the Apache FAQ for details",
ap_server_argv0);
}
#endif
- ap_log_error(APLOG_MARK, APLOG_EMERG, server_conf,
+ ap_log_error(APLOG_MARK, APLOG_EMERG, errno, server_conf,
"could not call shmget");
exit(APEXIT_INIT);
}
"could not call shmget");
exit(APEXIT_INIT);
}
- ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_INFO, server_conf,
+ ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_INFO, 0, server_conf,
"created shared memory segment #%d", shmid);
#ifdef MOVEBREAK
"created shared memory segment #%d", shmid);
#ifdef MOVEBREAK
#define BADSHMAT ((scoreboard *)(-1))
if ((ap_scoreboard_image = (scoreboard *) shmat(shmid, 0, 0)) == BADSHMAT) {
#define BADSHMAT ((scoreboard *)(-1))
if ((ap_scoreboard_image = (scoreboard *) shmat(shmid, 0, 0)) == BADSHMAT) {
- ap_log_error(APLOG_MARK, APLOG_EMERG, server_conf, "shmat error");
+ ap_log_error(APLOG_MARK, APLOG_EMERG, errno, server_conf, "shmat error");
/*
* We exit below, after we try to remove the segment
*/
}
else { /* only worry about permissions if we attached the segment */
if (shmctl(shmid, IPC_STAT, &shmbuf) != 0) {
/*
* We exit below, after we try to remove the segment
*/
}
else { /* only worry about permissions if we attached the segment */
if (shmctl(shmid, IPC_STAT, &shmbuf) != 0) {
- ap_log_error(APLOG_MARK, APLOG_ERR, server_conf,
+ ap_log_error(APLOG_MARK, APLOG_ERR, errno, server_conf,
"shmctl() could not stat segment #%d", shmid);
}
else {
shmbuf.shm_perm.uid = unixd_config.user_id;
shmbuf.shm_perm.gid = unixd_config.group_id;
if (shmctl(shmid, IPC_SET, &shmbuf) != 0) {
"shmctl() could not stat segment #%d", shmid);
}
else {
shmbuf.shm_perm.uid = unixd_config.user_id;
shmbuf.shm_perm.gid = unixd_config.group_id;
if (shmctl(shmid, IPC_SET, &shmbuf) != 0) {
- ap_log_error(APLOG_MARK, APLOG_ERR, server_conf,
+ ap_log_error(APLOG_MARK, APLOG_ERR, errno, server_conf,
"shmctl() could not set segment #%d", shmid);
}
}
"shmctl() could not set segment #%d", shmid);
}
}
* (small) tables.
*/
if (shmctl(shmid, IPC_RMID, NULL) != 0) {
* (small) tables.
*/
if (shmctl(shmid, IPC_RMID, NULL) != 0) {
- ap_log_error(APLOG_MARK, APLOG_WARNING, server_conf,
+ ap_log_error(APLOG_MARK, APLOG_WARNING, errno, server_conf,
"shmctl: IPC_RMID: could not remove shared memory segment #%d",
shmid);
}
"shmctl: IPC_RMID: could not remove shared memory segment #%d",
shmid);
}
case 3: /* 344ms */
/* perhaps it missed the SIGHUP, lets try again */
ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_WARNING,
case 3: /* 344ms */
/* perhaps it missed the SIGHUP, lets try again */
ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_WARNING,
"child process %d did not exit, sending another SIGHUP",
pid);
kill(pid, SIGHUP);
"child process %d did not exit, sending another SIGHUP",
pid);
kill(pid, SIGHUP);
case 7: /* 1.4sec */
/* ok, now it's being annoying */
ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_WARNING,
case 7: /* 1.4sec */
/* ok, now it's being annoying */
ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_WARNING,
"child process %d still did not exit, sending a SIGTERM",
pid);
kill(pid, SIGTERM);
break;
case 8: /* 6 sec */
/* die child scum */
"child process %d still did not exit, sending a SIGTERM",
pid);
kill(pid, SIGTERM);
break;
case 8: /* 6 sec */
/* die child scum */
- ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, server_conf,
+ ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, 0, server_conf,
"child process %d still did not exit, sending a SIGKILL",
pid);
kill(pid, SIGKILL);
"child process %d still did not exit, sending a SIGKILL",
pid);
kill(pid, SIGKILL);
* exited, we will likely fail to bind to the port
* after the restart.
*/
* exited, we will likely fail to bind to the port
* after the restart.
*/
- ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, server_conf,
+ ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, 0, server_conf,
"could not make child process %d exit, "
"attempting to continue anyway", pid);
break;
"could not make child process %d exit, "
"attempting to continue anyway", pid);
break;
sa.sa_flags = SA_RESETHAND;
#endif
if (sigaction(SIGSEGV, &sa, NULL) < 0)
sa.sa_flags = SA_RESETHAND;
#endif
if (sigaction(SIGSEGV, &sa, NULL) < 0)
- ap_log_error(APLOG_MARK, APLOG_WARNING, server_conf, "sigaction(SIGSEGV)");
+ ap_log_error(APLOG_MARK, APLOG_WARNING, errno, server_conf, "sigaction(SIGSEGV)");
#ifdef SIGBUS
if (sigaction(SIGBUS, &sa, NULL) < 0)
#ifdef SIGBUS
if (sigaction(SIGBUS, &sa, NULL) < 0)
- ap_log_error(APLOG_MARK, APLOG_WARNING, server_conf, "sigaction(SIGBUS)");
+ ap_log_error(APLOG_MARK, APLOG_WARNING, errno, server_conf, "sigaction(SIGBUS)");
#endif
#ifdef SIGABORT
if (sigaction(SIGABORT, &sa, NULL) < 0)
#endif
#ifdef SIGABORT
if (sigaction(SIGABORT, &sa, NULL) < 0)
- ap_log_error(APLOG_MARK, APLOG_WARNING, server_conf, "sigaction(SIGABORT)");
+ ap_log_error(APLOG_MARK, APLOG_WARNING, errno, server_conf, "sigaction(SIGABORT)");
#endif
#ifdef SIGABRT
if (sigaction(SIGABRT, &sa, NULL) < 0)
#endif
#ifdef SIGABRT
if (sigaction(SIGABRT, &sa, NULL) < 0)
- ap_log_error(APLOG_MARK, APLOG_WARNING, server_conf, "sigaction(SIGABRT)");
+ ap_log_error(APLOG_MARK, APLOG_WARNING, errno, server_conf, "sigaction(SIGABRT)");
#endif
#ifdef SIGILL
if (sigaction(SIGILL, &sa, NULL) < 0)
#endif
#ifdef SIGILL
if (sigaction(SIGILL, &sa, NULL) < 0)
- ap_log_error(APLOG_MARK, APLOG_WARNING, server_conf, "sigaction(SIGILL)");
+ ap_log_error(APLOG_MARK, APLOG_WARNING, errno, server_conf, "sigaction(SIGILL)");
#endif
sa.sa_flags = 0;
}
sa.sa_handler = sig_term;
if (sigaction(SIGTERM, &sa, NULL) < 0)
#endif
sa.sa_flags = 0;
}
sa.sa_handler = sig_term;
if (sigaction(SIGTERM, &sa, NULL) < 0)
- ap_log_error(APLOG_MARK, APLOG_WARNING, server_conf, "sigaction(SIGTERM)");
+ ap_log_error(APLOG_MARK, APLOG_WARNING, errno, server_conf, "sigaction(SIGTERM)");
#ifdef SIGINT
if (sigaction(SIGINT, &sa, NULL) < 0)
#ifdef SIGINT
if (sigaction(SIGINT, &sa, NULL) < 0)
- ap_log_error(APLOG_MARK, APLOG_WARNING, server_conf, "sigaction(SIGINT)");
+ ap_log_error(APLOG_MARK, APLOG_WARNING, errno, server_conf, "sigaction(SIGINT)");
#endif
#ifdef SIGXCPU
sa.sa_handler = SIG_DFL;
if (sigaction(SIGXCPU, &sa, NULL) < 0)
#endif
#ifdef SIGXCPU
sa.sa_handler = SIG_DFL;
if (sigaction(SIGXCPU, &sa, NULL) < 0)
- ap_log_error(APLOG_MARK, APLOG_WARNING, server_conf, "sigaction(SIGXCPU)");
+ ap_log_error(APLOG_MARK, APLOG_WARNING, errno, server_conf, "sigaction(SIGXCPU)");
#endif
#ifdef SIGXFSZ
sa.sa_handler = SIG_DFL;
if (sigaction(SIGXFSZ, &sa, NULL) < 0)
#endif
#ifdef SIGXFSZ
sa.sa_handler = SIG_DFL;
if (sigaction(SIGXFSZ, &sa, NULL) < 0)
- ap_log_error(APLOG_MARK, APLOG_WARNING, server_conf, "sigaction(SIGXFSZ)");
+ ap_log_error(APLOG_MARK, APLOG_WARNING, errno, server_conf, "sigaction(SIGXFSZ)");
#endif
#ifdef SIGPIPE
sa.sa_handler = SIG_IGN;
if (sigaction(SIGPIPE, &sa, NULL) < 0)
#endif
#ifdef SIGPIPE
sa.sa_handler = SIG_IGN;
if (sigaction(SIGPIPE, &sa, NULL) < 0)
- ap_log_error(APLOG_MARK, APLOG_WARNING, server_conf, "sigaction(SIGPIPE)");
+ ap_log_error(APLOG_MARK, APLOG_WARNING, errno, server_conf, "sigaction(SIGPIPE)");
#endif
/* we want to ignore HUPs and USR1 while we're busy processing one */
#endif
/* we want to ignore HUPs and USR1 while we're busy processing one */
sigaddset(&sa.sa_mask, SIGUSR1);
sa.sa_handler = restart;
if (sigaction(SIGHUP, &sa, NULL) < 0)
sigaddset(&sa.sa_mask, SIGUSR1);
sa.sa_handler = restart;
if (sigaction(SIGHUP, &sa, NULL) < 0)
- ap_log_error(APLOG_MARK, APLOG_WARNING, server_conf, "sigaction(SIGHUP)");
+ ap_log_error(APLOG_MARK, APLOG_WARNING, errno, server_conf, "sigaction(SIGHUP)");
if (sigaction(SIGUSR1, &sa, NULL) < 0)
if (sigaction(SIGUSR1, &sa, NULL) < 0)
- ap_log_error(APLOG_MARK, APLOG_WARNING, server_conf, "sigaction(SIGUSR1)");
+ ap_log_error(APLOG_MARK, APLOG_WARNING, errno, server_conf, "sigaction(SIGUSR1)");
#else
if (!one_process) {
signal(SIGSEGV, sig_coredump);
#else
if (!one_process) {
signal(SIGSEGV, sig_coredump);
* on Linux 2.0.x we seem to end up with EFAULT
* occasionally, and we'd loop forever due to it.
*/
* on Linux 2.0.x we seem to end up with EFAULT
* occasionally, and we'd loop forever due to it.
*/
- ap_log_error(APLOG_MARK, APLOG_ERR, server_conf, "select: (listen)");
+ ap_log_error(APLOG_MARK, APLOG_ERR, errno, server_conf, "select: (listen)");
* Ben Hyde noted that temporary ENETDOWN situations
* occur in mobile IP.
*/
* Ben Hyde noted that temporary ENETDOWN situations
* occur in mobile IP.
*/
- ap_log_error(APLOG_MARK, APLOG_EMERG, server_conf,
+ ap_log_error(APLOG_MARK, APLOG_EMERG, errno, server_conf,
"accept: giving up.");
clean_child_exit(APEXIT_CHILDFATAL);
#endif /*ENETDOWN*/
#ifdef TPF
case EINACT:
"accept: giving up.");
clean_child_exit(APEXIT_CHILDFATAL);
#endif /*ENETDOWN*/
#ifdef TPF
case EINACT:
- ap_log_error(APLOG_MARK, APLOG_EMERG, server_conf,
+ ap_log_error(APLOG_MARK, APLOG_EMERG, errno, server_conf,
"offload device inactive");
clean_child_exit(APEXIT_CHILDFATAL);
break;
default:
"offload device inactive");
clean_child_exit(APEXIT_CHILDFATAL);
break;
default:
- ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, server_conf,
+ ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, 0, server_conf,
"select/accept error (%u)", errno);
clean_child_exit(APEXIT_CHILDFATAL);
#else
default:
"select/accept error (%u)", errno);
clean_child_exit(APEXIT_CHILDFATAL);
#else
default:
- ap_log_error(APLOG_MARK, APLOG_ERR, server_conf,
+ ap_log_error(APLOG_MARK, APLOG_ERR, errno, server_conf,
"accept: (client socket)");
clean_child_exit(1);
#endif
"accept: (client socket)");
clean_child_exit(1);
#endif
clen = sizeof(sa_server);
if (getsockname(sockdes, &sa_server, &clen) < 0) {
clen = sizeof(sa_server);
if (getsockname(sockdes, &sa_server, &clen) < 0) {
- ap_log_error(APLOG_MARK, APLOG_ERR, server_conf, "getsockname");
+ ap_log_error(APLOG_MARK, APLOG_ERR, errno, server_conf, "getsockname");
ap_close_socket(csd);
continue;
}
ap_close_socket(csd);
continue;
}
iol = unix_attach_socket(sockdes);
if (iol == NULL) {
if (errno == EBADF) {
iol = unix_attach_socket(sockdes);
if (iol == NULL) {
if (errno == EBADF) {
- ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_WARNING, NULL,
+ ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_WARNING, 0, NULL,
"filedescriptor (%u) larger than FD_SETSIZE (%u) "
"found, you probably need to rebuild Apache with a "
"larger FD_SETSIZE", sockdes, FD_SETSIZE);
}
else {
"filedescriptor (%u) larger than FD_SETSIZE (%u) "
"found, you probably need to rebuild Apache with a "
"larger FD_SETSIZE", sockdes, FD_SETSIZE);
}
else {
- ap_log_error(APLOG_MARK, APLOG_WARNING, NULL,
+ ap_log_error(APLOG_MARK, APLOG_WARNING, errno, NULL,
"error attaching to socket");
}
ap_close_socket(csd);
"error attaching to socket");
}
ap_close_socket(csd);
#else
if ((pid = fork()) == -1) {
#endif
#else
if ((pid = fork()) == -1) {
#endif
- ap_log_error(APLOG_MARK, APLOG_ERR, s, "fork: Unable to fork new process");
+ ap_log_error(APLOG_MARK, APLOG_ERR, errno, s, "fork: Unable to fork new process");
/* fork didn't succeed. Fix the scoreboard or else
* it will say SERVER_STARTING forever and ever
/* fork didn't succeed. Fix the scoreboard or else
* it will say SERVER_STARTING forever and ever
static int reported = 0;
if (!reported) {
static int reported = 0;
if (!reported) {
- ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, server_conf,
+ ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, 0, server_conf,
"server reached MaxClients setting, consider"
" raising the MaxClients setting");
reported = 1;
"server reached MaxClients setting, consider"
" raising the MaxClients setting");
reported = 1;
}
else {
if (idle_spawn_rate >= 8) {
}
else {
if (idle_spawn_rate >= 8) {
- ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_INFO, server_conf,
+ ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_INFO, 0, server_conf,
"server seems busy, (you may need "
"to increase StartServers, or Min/MaxSpareServers), "
"spawning %d children, there are %d idle, and "
"server seems busy, (you may need "
"to increase StartServers, or Min/MaxSpareServers), "
"spawning %d children, there are %d idle, and "
*/
if ((WIFEXITED(status)) &&
WEXITSTATUS(status) == APEXIT_CHILDFATAL) {
*/
if ((WIFEXITED(status)) &&
WEXITSTATUS(status) == APEXIT_CHILDFATAL) {
- ap_log_error(APLOG_MARK, APLOG_ALERT|APLOG_NOERRNO, server_conf,
+ ap_log_error(APLOG_MARK, APLOG_ALERT|APLOG_NOERRNO, 0, server_conf,
"Child %d returned a Fatal error... \n"
"Apache is exiting!",
pid);
"Child %d returned a Fatal error... \n"
"Apache is exiting!",
pid);
#ifdef WCOREDUMP
if (WCOREDUMP(status)) {
ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_NOTICE,
#ifdef WCOREDUMP
if (WCOREDUMP(status)) {
ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_NOTICE,
"child pid %d exit signal %s (%d), "
"possible coredump in %s",
pid, (WTERMSIG(status) >= NumSIG) ? "" :
"child pid %d exit signal %s (%d), "
"possible coredump in %s",
pid, (WTERMSIG(status) >= NumSIG) ? "" :
else {
#endif
ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_NOTICE,
else {
#endif
ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_NOTICE,
"child pid %d exit signal %s (%d)", pid,
SYS_SIGLIST[WTERMSIG(status)], WTERMSIG(status));
#ifdef WCOREDUMP
"child pid %d exit signal %s (%d)", pid,
SYS_SIGLIST[WTERMSIG(status)], WTERMSIG(status));
#ifdef WCOREDUMP
int sockdes;
if (ap_listen_open(s->process, s->port)) {
int sockdes;
if (ap_listen_open(s->process, s->port)) {
- ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_ALERT, s,
+ ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_ALERT, 0, s,
"no listening sockets available, shutting down");
return -1;
}
"no listening sockets available, shutting down");
return -1;
}
hold_off_on_exponential_spawning = 10;
}
hold_off_on_exponential_spawning = 10;
}
- ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_NOTICE, server_conf,
+ ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_NOTICE, 0, server_conf,
"%s configured -- resuming normal operations",
ap_get_server_version());
"%s configured -- resuming normal operations",
ap_get_server_version());
- ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_INFO, server_conf,
+ ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_INFO, 0, server_conf,
"Server built: %s", ap_get_server_built());
restart_pending = shutdown_pending = 0;
"Server built: %s", ap_get_server_built());
restart_pending = shutdown_pending = 0;
* scoreboard. Somehow we don't know about this
* child.
*/
* scoreboard. Somehow we don't know about this
* child.
*/
- ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_WARNING, server_conf,
+ ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_WARNING,
+ 0, server_conf,
"long lost child came home! (pid %d)", pid);
}
/* Don't perform idle maintenance when a child dies,
"long lost child came home! (pid %d)", pid);
}
/* Don't perform idle maintenance when a child dies,
* Kill child processes, tell them to call child_exit, etc...
*/
if (ap_killpg(getpgrp(), SIGTERM) < 0) {
* Kill child processes, tell them to call child_exit, etc...
*/
if (ap_killpg(getpgrp(), SIGTERM) < 0) {
- ap_log_error(APLOG_MARK, APLOG_WARNING, server_conf, "killpg SIGTERM");
+ ap_log_error(APLOG_MARK, APLOG_WARNING, errno, server_conf, "killpg SIGTERM");
}
reclaim_child_processes(1); /* Start with SIGTERM */
}
reclaim_child_processes(1); /* Start with SIGTERM */
pidfile = ap_server_root_relative (pconf, ap_pid_fname);
if ( pidfile != NULL && unlink(pidfile) == 0)
ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_INFO,
pidfile = ap_server_root_relative (pconf, ap_pid_fname);
if ( pidfile != NULL && unlink(pidfile) == 0)
ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_INFO,
"removed PID file %s (pid=%ld)",
pidfile, (long)getpid());
}
"removed PID file %s (pid=%ld)",
pidfile, (long)getpid());
}
- ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_NOTICE, server_conf,
+ ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_NOTICE, 0, server_conf,
"caught SIGTERM, shutting down");
return 1;
}
"caught SIGTERM, shutting down");
return 1;
}
#ifndef SCOREBOARD_FILE
int i;
#endif
#ifndef SCOREBOARD_FILE
int i;
#endif
- ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_NOTICE, server_conf,
+ ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_NOTICE, 0, server_conf,
"SIGUSR1 received. Doing graceful restart");
/* kill off the idle ones */
if (ap_killpg(getpgrp(), SIGUSR1) < 0) {
"SIGUSR1 received. Doing graceful restart");
/* kill off the idle ones */
if (ap_killpg(getpgrp(), SIGUSR1) < 0) {
- ap_log_error(APLOG_MARK, APLOG_WARNING, server_conf, "killpg SIGUSR1");
+ ap_log_error(APLOG_MARK, APLOG_WARNING, errno, server_conf, "killpg SIGUSR1");
}
#ifndef SCOREBOARD_FILE
/* This is mostly for debugging... so that we know what is still
}
#ifndef SCOREBOARD_FILE
/* This is mostly for debugging... so that we know what is still
else {
/* Kill 'em off */
if (ap_killpg(getpgrp(), SIGHUP) < 0) {
else {
/* Kill 'em off */
if (ap_killpg(getpgrp(), SIGHUP) < 0) {
- ap_log_error(APLOG_MARK, APLOG_WARNING, server_conf, "killpg SIGHUP");
+ ap_log_error(APLOG_MARK, APLOG_WARNING, errno, server_conf, "killpg SIGHUP");
}
reclaim_child_processes(0); /* Not when just starting up */
}
reclaim_child_processes(0); /* Not when just starting up */
- ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_NOTICE, server_conf,
+ ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_NOTICE, 0, server_conf,
"SIGHUP received. Attempting to restart");
}
"SIGHUP received. Attempting to restart");
}
{
unsigned int rmt_port, our_port;
unsigned int sav_rmt_port, sav_our_port;
{
unsigned int rmt_port, our_port;
unsigned int sav_rmt_port, sav_our_port;
int i;
char *cp;
char buffer[RFC1413_MAXDATA + 1];
int i;
char *cp;
char buffer[RFC1413_MAXDATA + 1];
ap_setport(sock, ANY_PORT);
ap_setipaddr(sock, local_ip);
ap_setport(sock, ANY_PORT);
ap_setipaddr(sock, local_ip);
- if (ap_bind(sock) != APR_SUCCESS) {
- ap_log_error(APLOG_MARK, APLOG_CRIT, srv,
+ if ((status = ap_bind(sock)) != APR_SUCCESS) {
+ ap_log_error(APLOG_MARK, APLOG_CRIT, status, srv,
"bind: rfc1413: Error binding to local port");
return -1;
}
"bind: rfc1413: Error binding to local port");
return -1;
}
i = 0;
while(i < strlen(buffer)) {
int j = strlen(buffer + i);
i = 0;
while(i < strlen(buffer)) {
int j = strlen(buffer + i);
- ap_status_t stat;
- stat = ap_send(sock, buffer+i, &j);
- if (stat != APR_SUCCESS && stat != APR_EINTR) {
- ap_log_error(APLOG_MARK, APLOG_CRIT, srv,
- "write: rfc1413: error sending request");
- return -1;
+ ap_status_t status;
+ status = ap_send(sock, buffer+i, &j);
+ if (status != APR_SUCCESS && status != APR_EINTR) {
+ ap_log_error(APLOG_MARK, APLOG_CRIT, status, srv,
+ "write: rfc1413: error sending request");
+ return -1;
}
else if (j > 0) {
i+=j;
}
else if (j > 0) {
i+=j;
*/
while((cp = strchr(buffer, '\012')) == NULL && i < sizeof(buffer) - 1) {
int j = sizeof(buffer) - 1 - i;
*/
while((cp = strchr(buffer, '\012')) == NULL && i < sizeof(buffer) - 1) {
int j = sizeof(buffer) - 1 - i;
- ap_status_t stat;
- stat = ap_recv(sock, buffer+i, &j);
- if (stat != APR_SUCCESS && stat != APR_EINTR) {
- ap_log_error(APLOG_MARK, APLOG_CRIT, srv,
+ ap_status_t status;
+ status = ap_recv(sock, buffer+i, &j);
+ if (status != APR_SUCCESS && status != APR_EINTR) {
+ ap_log_error(APLOG_MARK, APLOG_CRIT, status, srv,
"read: rfc1413: error reading response");
"read: rfc1413: error reading response");
}
else if (j > 0) {
i+=j;
}
else if (j > 0) {
i+=j;
/* rfc1413 - return remote user name, given socket structures */
char *ap_rfc1413(conn_rec *conn, server_rec *srv)
{
/* rfc1413 - return remote user name, given socket structures */
char *ap_rfc1413(conn_rec *conn, server_rec *srv)
{
static char user[RFC1413_USERLEN + 1]; /* XXX */
static char *result;
static ap_socket_t *sock;
result = FROM_UNKNOWN;
static char user[RFC1413_USERLEN + 1]; /* XXX */
static char *result;
static ap_socket_t *sock;
result = FROM_UNKNOWN;
- if (ap_create_tcp_socket(&sock, conn->pool) != APR_SUCCESS) {
- ap_log_error(APLOG_MARK, APLOG_CRIT, srv,
+ if ((status = ap_create_tcp_socket(&sock, conn->pool)) != APR_SUCCESS) {
+ ap_log_error(APLOG_MARK, APLOG_CRIT, status, srv,
"socket: rfc1413: error creating socket");
conn->remote_logname = result;
}
"socket: rfc1413: error creating socket");
conn->remote_logname = result;
}
ap_filetype_e type;
if (name == NULL) {
ap_filetype_e type;
if (name == NULL) {
- ap_log_error(APLOG_MARK, APLOG_ERR | APLOG_NOERRNO, NULL,
+ ap_log_error(APLOG_MARK, APLOG_ERR | APLOG_NOERRNO, 0, NULL,
"Internal error: pcfg_openfile() called with NULL filename");
return NULL;
}
if (!ap_os_is_filename_valid(name)) {
"Internal error: pcfg_openfile() called with NULL filename");
return NULL;
}
if (!ap_os_is_filename_valid(name)) {
- ap_log_error(APLOG_MARK, APLOG_ERR | APLOG_NOERRNO, NULL,
+ ap_log_error(APLOG_MARK, APLOG_ERR | APLOG_NOERRNO, 0, NULL,
"Access to config file %s denied: not a valid filename",
name);
errno = EACCES;
"Access to config file %s denied: not a valid filename",
name);
errno = EACCES;
strcmp(name, "/dev/null") != 0) {
#endif /* WIN32 || OS2 */
saved_errno = errno;
strcmp(name, "/dev/null") != 0) {
#endif /* WIN32 || OS2 */
saved_errno = errno;
- ap_log_error(APLOG_MARK, APLOG_ERR | APLOG_NOERRNO, NULL,
+ ap_log_error(APLOG_MARK, APLOG_ERR | APLOG_NOERRNO, 0, NULL,
"Access to file %s denied by server: not a regular file",
name);
ap_close(file);
"Access to file %s denied by server: not a regular file",
name);
ap_close(file);
while (1) {
if ((*getsfunc) (w, MAX_STRING_LEN - 1, getsfunc_data) == 0) {
while (1) {
if ((*getsfunc) (w, MAX_STRING_LEN - 1, getsfunc_data) == 0) {
- ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, r,
+ ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, 0, r,
"Premature end of script headers: %s", r->filename);
return HTTP_INTERNAL_SERVER_ERROR;
}
"Premature end of script headers: %s", r->filename);
return HTTP_INTERNAL_SERVER_ERROR;
}
- ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, r,
+ ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, 0, r,
"%s: %s", malformed, r->filename);
return HTTP_INTERNAL_SERVER_ERROR;
}
"%s: %s", malformed, r->filename);
return HTTP_INTERNAL_SERVER_ERROR;
}
hep = gethostbyname(w);
if ((!hep) || (hep->h_addrtype != AF_INET || !hep->h_addr_list[0])) {
hep = gethostbyname(w);
if ((!hep) || (hep->h_addrtype != AF_INET || !hep->h_addr_list[0])) {
- ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, NULL,
+ ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, 0, NULL,
"Cannot resolve host name %s --- ignoring!", w);
if (t != NULL)
*t = ':';
"Cannot resolve host name %s --- ignoring!", w);
if (t != NULL)
*t = ':';
other = find_default_server(sar->host_port);
if (other && other->sar->host_port != 0) {
other = find_default_server(sar->host_port);
if (other && other->sar->host_port != 0) {
- ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_WARNING, main_s,
+ ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_WARNING, 0, main_s,
"_default_ VirtualHost overlap on port %u,"
" the first has precedence", sar->host_port);
}
"_default_ VirtualHost overlap on port %u,"
" the first has precedence", sar->host_port);
}
ic->server = s;
if (sar->host_port != ic->sar->host_port) {
/* one of the two is a * port, the other isn't */
ic->server = s;
if (sar->host_port != ic->sar->host_port) {
/* one of the two is a * port, the other isn't */
- ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, main_s,
+ ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, 0, main_s,
"VirtualHost %s:%u -- mixing * "
"ports and non-* ports with "
"a NameVirtualHost address is not supported,"
"VirtualHost %s:%u -- mixing * "
"ports and non-* ports with "
"a NameVirtualHost address is not supported,"
- ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_WARNING, main_s,
+ ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_WARNING, 0, main_s,
"VirtualHost %s:%u overlaps with "
"VirtualHost %s:%u, the first has precedence, "
"perhaps you need a NameVirtualHost directive",
"VirtualHost %s:%u overlaps with "
"VirtualHost %s:%u, the first has precedence, "
"perhaps you need a NameVirtualHost directive",
else {
/* again, what can we do? They didn't specify a
ServerName, and their DNS isn't working. -djg */
else {
/* again, what can we do? They didn't specify a
ServerName, and their DNS isn't working. -djg */
- ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, main_s,
+ ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, 0, main_s,
"Failed to resolve server name "
"for %s (check DNS) -- or specify an explicit "
"ServerName",
"Failed to resolve server name "
"for %s (check DNS) -- or specify an explicit "
"ServerName",
ipaddr_chain *ic = *pic;
if (ic->server == NULL) {
ipaddr_chain *ic = *pic;
if (ic->server == NULL) {
- ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_WARNING, main_s,
+ ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_WARNING, 0, main_s,
"NameVirtualHost %s:%u has no VirtualHosts",
ic->sar->virthost, ic->sar->host_port);
*pic = ic->next;
"NameVirtualHost %s:%u has no VirtualHosts",
ic->sar->virthost, ic->sar->host_port);
*pic = ic->next;
* by Alexei Kosut, based on htpasswd.c, by Rob McCool
*/
* by Alexei Kosut, based on htpasswd.c, by Rob McCool
*/
#include "ap_config.h"
#include <sys/types.h>
#include "ap.h"
#include "ap_config.h"
#include <sys/types.h>
#include "ap.h"
char pwin[MAX_STRING_LEN];
char pwv[MAX_STRING_LEN];
unsigned int i;
char pwin[MAX_STRING_LEN];
char pwv[MAX_STRING_LEN];
unsigned int i;
- if (ap_getpass("New password: ", pwin, sizeof(pwin)) != 0) {
+ bufsize = sizeof(pwin);
+ if (ap_getpass("New password: ", pwin, &bufsize) != 0) {
fprintf(stderr, "password too long");
exit(5);
}
fprintf(stderr, "password too long");
exit(5);
}
- ap_getpass("Re-type new password: ", pwv, sizeof(pwv));
+ bufsize = sizeof(pwv);
+ ap_getpass("Re-type new password: ", pwv, &bufsize);
if (strcmp(pwin, pwv) != 0) {
fprintf(stderr, "They don't match, sorry.\n");
if (tn) {
if (strcmp(pwin, pwv) != 0) {
fprintf(stderr, "They don't match, sorry.\n");
if (tn) {
* 6: Failure; username contains illegal or reserved characters
*/
* 6: Failure; username contains illegal or reserved characters
*/
#include "ap_config.h"
#include <sys/types.h>
#include <signal.h>
#include "ap_config.h"
#include <sys/types.h>
#include <signal.h>
char pwin[MAX_STRING_LEN];
char pwv[MAX_STRING_LEN];
char salt[9];
char pwin[MAX_STRING_LEN];
char pwv[MAX_STRING_LEN];
char salt[9];
if (passwd != NULL) {
pw = passwd;
}
else {
if (passwd != NULL) {
pw = passwd;
}
else {
- if (ap_getpass("New password: ", pwin, sizeof(pwin)) != 0) {
+ bufsize = sizeof(pwin);
+ if (ap_getpass("New password: ", pwin, &bufsize) != 0) {
ap_snprintf(record, (rlen - 1), "password too long (>%d)",
sizeof(pwin) - 1);
return ERR_OVERFLOW;
}
ap_snprintf(record, (rlen - 1), "password too long (>%d)",
sizeof(pwin) - 1);
return ERR_OVERFLOW;
}
- ap_getpass("Re-type new password: ", pwv, sizeof(pwv));
+ bufsize = sizeof(pwv);
+ ap_getpass("Re-type new password: ", pwv, &bufsize);
if (strcmp(pwin, pwv) != 0) {
ap_cpystrn(record, "password verification error", (rlen - 1));
return ERR_PWMISMATCH;
if (strcmp(pwin, pwv) != 0) {
ap_cpystrn(record, "password verification error", (rlen - 1));
return ERR_PWMISMATCH;