diff options
-rw-r--r-- | configure.in | 1 | ||||
-rw-r--r-- | modules/aaa/mod_auth_db.c | 10 | ||||
-rw-r--r-- | modules/aaa/mod_auth_digest.c | 3 | ||||
-rw-r--r-- | modules/proxy/proxy_connect.c | 4 | ||||
-rw-r--r-- | modules/proxy/proxy_ftp.c | 7 | ||||
-rw-r--r-- | modules/proxy/proxy_http.c | 3 | ||||
-rw-r--r-- | os/beos/beosd.c | 6 | ||||
-rw-r--r-- | os/unix/unixd.c | 6 | ||||
-rw-r--r-- | os/win32/os.h | 1 | ||||
-rw-r--r-- | server/log.c | 18 | ||||
-rw-r--r-- | server/util.c | 33 | ||||
-rw-r--r-- | support/suexec.c | 6 |
12 files changed, 49 insertions, 49 deletions
diff --git a/configure.in b/configure.in index 665a2920b6..0bcb5e7fc6 100644 --- a/configure.in +++ b/configure.in @@ -104,7 +104,6 @@ strdup \ strcasecmp \ strncasecmp \ strstr \ -strerror \ initgroups \ waitpid \ memmove \ diff --git a/modules/aaa/mod_auth_db.c b/modules/aaa/mod_auth_db.c index cbc263376e..1d325f922e 100644 --- a/modules/aaa/mod_auth_db.c +++ b/modules/aaa/mod_auth_db.c @@ -319,16 +319,10 @@ static int db_authenticate_basic_user(request_rec *r) invalid_pw = ap_validate_password(sent_pw, real_pw); if (invalid_pw != APR_SUCCESS) { -#ifdef HAVE_APR_STRERROR + char buf[120] ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, 0, r, "DB user %s: authentication failure for \"%s\": %s", - r->user, r->uri, apr_strerror(invalid_pw)); -#else - ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, 0, r, - "DB user %s: authentication failure for \"%s\": %d", - r->user, r->uri, "error number", - invalid_pw); -#endif + r->user, r->uri, ap_strerror(invalid_pw, buf, sizeof(buf))); ap_note_basic_auth_failure(r); return AUTH_REQUIRED; } diff --git a/modules/aaa/mod_auth_digest.c b/modules/aaa/mod_auth_digest.c index f84182fa82..bd32184751 100644 --- a/modules/aaa/mod_auth_digest.c +++ b/modules/aaa/mod_auth_digest.c @@ -302,9 +302,10 @@ static void initialize_secret(server_rec *s) status = ap_generate_random_bytes(secret, sizeof(secret)); if(!(status == APR_SUCCESS)) { + char buf[120]; ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_CRIT, 0, s, "Digest: error generating secret: %s", - /*ap_strerror(status)*/ "need ap_strerror here"); + ap_strerror(status, buf, sizeof(buf))); exit(1); } diff --git a/modules/proxy/proxy_connect.c b/modules/proxy/proxy_connect.c index 7bf206a447..b87d81b9ac 100644 --- a/modules/proxy/proxy_connect.c +++ b/modules/proxy/proxy_connect.c @@ -210,10 +210,12 @@ int ap_proxy_connect_handler(request_rec *r, cache_req *c, char *url, j++; } if (i == -1) { + char buf[120]; ap_pclosesocket(r->pool, sock); return ap_proxyerror(r, HTTP_INTERNAL_SERVER_ERROR, ap_pstrcat(r->pool, "Could not connect to remote machine:<br>", - strerror(errno), NULL)); + ap_strerror(errno, buf, sizeof(buf)), + NULL)); } /* If we are connecting through a remote proxy, we need to pass diff --git a/modules/proxy/proxy_ftp.c b/modules/proxy/proxy_ftp.c index 9804bcd510..8b2e6ec086 100644 --- a/modules/proxy/proxy_ftp.c +++ b/modules/proxy/proxy_ftp.c @@ -605,10 +605,11 @@ int ap_proxy_ftp_handler(request_rec *r, cache_req *c, char *url) } #endif if (i == -1) { + char buf[120]; ap_pclosesocket(p, sock); return ap_proxyerror(r, HTTP_BAD_GATEWAY, ap_pstrcat(r->pool, "Could not connect to remote machine: ", - strerror(errno), NULL)); + ap_strerror(errno, buf, sizeof(buf)), NULL)); } f = ap_bcreate(p, B_RDWR | B_SOCKET); @@ -855,10 +856,12 @@ int ap_proxy_ftp_handler(request_rec *r, cache_req *c, char *url) i = ap_proxy_doconnect(dsock, &data_addr, r); if (i == -1) { + char buf[120]; return ap_proxyerror(r, HTTP_BAD_GATEWAY, ap_pstrcat(r->pool, "Could not connect to remote machine: ", - strerror(errno), NULL)); + ap_strerror(errno, buf, + sizeof(buf)), NULL)); } else { pasvmode = 1; diff --git a/modules/proxy/proxy_http.c b/modules/proxy/proxy_http.c index 895fb9ec93..71f24c9b70 100644 --- a/modules/proxy/proxy_http.c +++ b/modules/proxy/proxy_http.c @@ -293,9 +293,10 @@ int ap_proxy_http_handler(request_rec *r, cache_req *c, char *url, if (proxyhost != NULL) return DECLINED; /* try again another way */ else + char buf[120]; return ap_proxyerror(r, HTTP_BAD_GATEWAY, ap_pstrcat(r->pool, "Could not connect to remote machine: ", - strerror(errno), NULL)); + ap_strerror(errno, buf, sizeof(buf)), NULL)); } clear_connection(r->pool, r->headers_in); /* Strip connection-based headers */ diff --git a/os/beos/beosd.c b/os/beos/beosd.c index 93ec59fca1..09c8d1fa61 100644 --- a/os/beos/beosd.c +++ b/os/beos/beosd.c @@ -81,9 +81,10 @@ void beosd_detach(void) /* close out the standard file descriptors */ if (freopen("/dev/null", "r", stdin) == NULL) { + char buf[120]; ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, "%s: unable to replace stdin with /dev/null: %s", - ap_server_argv0, strerror(errno)); + ap_server_argv0, ap_strerror(errno, buf, sizeof(buf))); /* continue anyhow -- note we can't close out descriptor 0 because we * have nothing to replace it with, and if we didn't have a descriptor * 0 the next file would be created with that value ... leading to @@ -91,9 +92,10 @@ void beosd_detach(void) */ } if (freopen("/dev/null", "w", stdout) == NULL) { + char buf[120]; ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, "%s: unable to replace stdout with /dev/null: %s", - ap_server_argv0, strerror(errno)); + ap_server_argv0, ap_strerror(errno, buf, sizeof(buf))); } /* stderr is a tricky one, we really want it to be the error_log, * but we haven't opened that yet. So leave it alone for now and it'll diff --git a/os/unix/unixd.c b/os/unix/unixd.c index 4409dd7f5d..5a933a8531 100644 --- a/os/unix/unixd.c +++ b/os/unix/unixd.c @@ -118,9 +118,10 @@ void unixd_detach(void) /* close out the standard file descriptors */ if (freopen("/dev/null", "r", stdin) == NULL) { + char buf[120]; ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, "%s: unable to replace stdin with /dev/null: %s", - ap_server_argv0, strerror(errno)); + ap_server_argv0, ap_strerror(errno, buf, sizeof(buf))); /* continue anyhow -- note we can't close out descriptor 0 because we * have nothing to replace it with, and if we didn't have a descriptor * 0 the next file would be created with that value ... leading to @@ -128,9 +129,10 @@ void unixd_detach(void) */ } if (freopen("/dev/null", "w", stdout) == NULL) { + char buf[120]; ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, "%s: unable to replace stdout with /dev/null: %s", - ap_server_argv0, strerror(errno)); + ap_server_argv0, ap_strerror(errno, buf, sizeof(buf))); } /* stderr is a tricky one, we really want it to be the error_log, * but we haven't opened that yet. So leave it alone for now and it'll diff --git a/os/win32/os.h b/os/win32/os.h index 1b5deb3e4d..d20914d32f 100644 --- a/os/win32/os.h +++ b/os/win32/os.h @@ -118,7 +118,6 @@ typedef char * caddr_t; #define HAVE_MEMMOVE #define HAVE_STRCASECMP #define HAVE_STRNCASECMP -#define HAVE_STRERROR #define HAVE_STRDUP #define HAVE_STRSTR diff --git a/server/log.c b/server/log.c index 60bd796a15..9e8d6c93ed 100644 --- a/server/log.c +++ b/server/log.c @@ -590,17 +590,19 @@ static int piped_log_spawn(piped_log *pl) int rc; ap_procattr_t *procattr; ap_proc_t procnew; + ap_status_t status; #ifdef SIGHUP ap_signal(SIGHUP, SIG_IGN); #endif - if ((ap_createprocattr_init(&procattr, pl->p) != APR_SUCCESS) || - (ap_setprocattr_childin(procattr, ap_piped_log_read_fd(pl), - ap_piped_log_write_fd(pl)) != APR_SUCCESS)) { + if (((status = ap_createprocattr_init(&procattr, pl->p)) != APR_SUCCESS) || + ((status = ap_setprocattr_childin(procattr, ap_piped_log_read_fd(pl), + ap_piped_log_write_fd(pl))) != APR_SUCCESS)) { + char buf[120]; /* Something bad happened, give up and go away. */ ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, - "piped_log_spawn: unable to exec '%s': %s", - pl->program, strerror (errno)); + "piped_log_spawn: unable to setup child process '%s': %s", + pl->program, ap_strerror(status, buf, sizeof(buf))); rc = -1; } else { @@ -630,6 +632,7 @@ static int piped_log_spawn(piped_log *pl) static void piped_log_maintenance(int reason, void *data, ap_wait_t status) { piped_log *pl = data; + ap_status_t stats; switch (reason) { case APR_OC_REASON_DEATH: @@ -647,12 +650,13 @@ static void piped_log_maintenance(int reason, void *data, ap_wait_t status) /* during a restart */ break; } - if (piped_log_spawn(pl) != APR_SUCCESS) { + if ((stats = piped_log_spawn(pl)) != APR_SUCCESS) { /* what can we do? This could be the error log we're having * problems opening up... */ + char buf[120]; ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, "piped_log_maintenance: unable to respawn '%s': %s", - pl->program, strerror(errno)); + pl->program, ap_strerror(stats, buf, sizeof(buf))); } break; diff --git a/server/util.c b/server/util.c index bc8b9c55e3..5c7e834aa8 100644 --- a/server/util.c +++ b/server/util.c @@ -838,7 +838,10 @@ API_EXPORT(ap_status_t) ap_pcfg_openfile(configfile_t **ret_cfg, ap_pool_t *p, c configfile_t *new_cfg; ap_file_t *file = NULL; ap_finfo_t finfo; - ap_status_t stat; + ap_status_t status; +#ifdef DEBUG + char buf[120]; +#endif if (name == NULL) { ap_log_error(APLOG_MARK, APLOG_ERR | APLOG_NOERRNO, 0, NULL, @@ -853,18 +856,19 @@ API_EXPORT(ap_status_t) ap_pcfg_openfile(configfile_t **ret_cfg, ap_pool_t *p, c return APR_EACCES; } - stat = ap_open(&file, name, APR_READ, APR_OS_DEFAULT, p); + status = ap_open(&file, name, APR_READ, APR_OS_DEFAULT, p); #ifdef DEBUG ap_log_error(APLOG_MARK, APLOG_DEBUG | APLOG_NOERRNO, NULL, "Opening config file %s (%s)", - name, (stat != APR_SUCCESS) ? strerror(errno) : "successful"); + name, (status != APR_SUCCESS) ? + ap_strerror(status, buf, sizeof(buf)) : "successful"); #endif - if (stat != APR_SUCCESS) - return stat; + if (status != APR_SUCCESS) + return status; - stat = ap_getfileinfo(&finfo, file); - if (stat != APR_SUCCESS) - return stat; + status = ap_getfileinfo(&finfo, file); + if (status != APR_SUCCESS) + return status; if (finfo.filetype != APR_REG && #if defined(WIN32) || defined(OS2) @@ -2025,19 +2029,6 @@ API_EXPORT(char *) ap_uuencode(ap_pool_t *p, char *string) return ap_pbase64encode(p, string); } -#ifndef HAVE_STRERROR -char * - strerror(int err) -{ - - char *p; - extern char *const sys_errlist[]; - - p = sys_errlist[err]; - return (p); -} -#endif - /* we want to downcase the type/subtype for comparison purposes * but nothing else because ;parameter=foo values are case sensitive. * XXX: in truth we want to downcase parameter names... but really, diff --git a/support/suexec.c b/support/suexec.c index c31a0f3751..e5e3215afe 100644 --- a/support/suexec.c +++ b/support/suexec.c @@ -251,6 +251,7 @@ int main(int argc, char *argv[]) struct group *gr; /* group entry holder */ struct stat dir_info; /* directory info holder */ struct stat prg_info; /* program info holder */ + char buf[120]; /* * If there are a proper number of arguments, set @@ -351,7 +352,7 @@ int main(int argc, char *argv[]) { case -1: /* Error */ log_err("failed to setup bs2000 environment for user %s: %s\n", - target_uname, strerror(errno)); + target_uname, ap_strerror(errno, buf, sizeof(buf))); exit(150); case 0: /* Child */ break; @@ -558,6 +559,7 @@ int main(int argc, char *argv[]) * * Oh well, log the failure and error out. */ - log_err("(%d)%s: exec failed (%s)\n", errno, strerror(errno), cmd); + log_err("(%d)%s: exec failed (%s)\n", errno, + ap_strerror(errno, buf, sizeof(buf)), cmd); exit(255); } |