From db3c12a79e7042184aac42488e3df38b6e09b5e8 Mon Sep 17 00:00:00 2001 From: Jeff Trawick Date: Mon, 17 Jul 2000 22:11:47 +0000 Subject: [PATCH] Fix some bad ap_log_error() invocations. Comment on a bad ap_log_rerror() invocation. Almost all of this is in code never compiled. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@85860 13f79535-47bb-0310-9956-ffa450edef68 --- modules/filters/mod_include.c | 3 +++ modules/proxy/mod_proxy.c | 10 +++++----- os/bs2000/bs2login.c | 12 ++++++------ os/tpf/os.c | 4 ++-- os/unix/unixd.c | 2 +- server/connection.c | 2 +- server/mpm/mpmt_pthread/mpmt_pthread.c | 2 +- server/util.c | 10 +++++----- server/util_uri.c | 8 ++++---- 9 files changed, 28 insertions(+), 25 deletions(-) diff --git a/modules/filters/mod_include.c b/modules/filters/mod_include.c index 95283bee4c..ad9cf916a9 100644 --- a/modules/filters/mod_include.c +++ b/modules/filters/mod_include.c @@ -1139,6 +1139,9 @@ static int find_file(request_rec *r, const char *directive, const char *tag, if (error_fmt) { ret = -1; + /* TODO: pass APLOG_NOERRNO if no ap_stat() failure; pass rv from ap_stat() + * otherwise + */ ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, error_fmt, to_send, r->filename); ap_rputs(error, r); } diff --git a/modules/proxy/mod_proxy.c b/modules/proxy/mod_proxy.c index 773d019e86..8ab2836740 100644 --- a/modules/proxy/mod_proxy.c +++ b/modules/proxy/mod_proxy.c @@ -644,30 +644,30 @@ static const char * if (ap_proxy_is_ipaddr(New, parms->pool)) { #if DEBUGGING - ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, 0, NULL, + ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, "Parsed addr %s", inet_ntoa(New->addr)); - ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, 0, NULL, + ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, "Parsed mask %s", inet_ntoa(New->mask)); #endif } else if (ap_proxy_is_domainname(New, parms->pool)) { ap_str_tolower(New->name); #if DEBUGGING - ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, 0, NULL, + ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, "Parsed domain %s", New->name); #endif } else if (ap_proxy_is_hostname(New, parms->pool)) { ap_str_tolower(New->name); #if DEBUGGING - ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, 0, NULL, + ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, "Parsed host %s", New->name); #endif } else { ap_proxy_is_word(New, parms->pool); #if DEBUGGING - ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, 0, NULL, + ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, "Parsed word %s", New->name); #endif } diff --git a/os/bs2000/bs2login.c b/os/bs2000/bs2login.c index 9f5483c0fd..38ef902747 100644 --- a/os/bs2000/bs2login.c +++ b/os/bs2000/bs2login.c @@ -119,7 +119,7 @@ static bs2_ForkType os_forktype(void) if (uname(&os_version) < 0) { - ap_log_error(APLOG_MARK, APLOG_ALERT, NULL, + ap_log_error(APLOG_MARK, APLOG_ALERT, errno, NULL, "uname() failed - aborting."); exit(APEXIT_CHILDFATAL); } @@ -132,7 +132,7 @@ static bs2_ForkType os_forktype(void) strcmp(os_version.release, "02.0A") == 0 || strcmp(os_version.release, "02.1A") == 0) { - ap_log_error(APLOG_MARK, APLOG_ERR|APLOG_NOERRNO, NULL, + ap_log_error(APLOG_MARK, APLOG_ERR|APLOG_NOERRNO, 0, NULL, "Error: unsupported OS version. " "You may encounter problems."); forktype = bs2_FORK; @@ -207,7 +207,7 @@ int os_init_job_environment(server_rec *server, const char *user_name, int one_p type = forktype = bs2_noFORK; - ap_log_error(APLOG_MARK, APLOG_ERR|APLOG_NOERRNO, server, + ap_log_error(APLOG_MARK, APLOG_ERR|APLOG_NOERRNO, 0, server, "The debug mode of Apache should only " "be started by an unprivileged user!"); return 0; @@ -220,7 +220,7 @@ int os_init_job_environment(server_rec *server, const char *user_name, int one_p /* An Account is required for _rini() */ if (bs2000_account == NULL) { - ap_log_error(APLOG_MARK, APLOG_ALERT|APLOG_NOERRNO, server, + ap_log_error(APLOG_MARK, APLOG_ALERT|APLOG_NOERRNO, 0, server, "No BS2000Account configured - cannot switch to User %s", user_name); exit(APEXIT_CHILDFATAL); @@ -242,7 +242,7 @@ int os_init_job_environment(server_rec *server, const char *user_name, int one_p /* Only the super user can switch identities. */ if (_rini(&inittask) != 0) { - ap_log_error(APLOG_MARK, APLOG_ALERT, server, + ap_log_error(APLOG_MARK, APLOG_ALERT, errno, server, "_rini: BS2000 auth failed for user \"%s\" acct \"%s\"", inittask.username, inittask.account); @@ -276,7 +276,7 @@ pid_t os_fork(const char *user) pid = ufork(username); if (pid == -1 && errno == EPERM) { - ap_log_error(APLOG_MARK, APLOG_EMERG, + ap_log_error(APLOG_MARK, APLOG_EMERG, errno, NULL, "ufork: Possible mis-configuration " "for user %s - Aborting.", user); exit(1); diff --git a/os/tpf/os.c b/os/tpf/os.c index 5cd9df4ae9..246b0a4f06 100644 --- a/os/tpf/os.c +++ b/os/tpf/os.c @@ -349,11 +349,11 @@ pid_t os_fork(server_rec *s, int slot) fflush(stdin); if (dup2(fileno(sock_fp), STDIN_FILENO) == -1) - ap_log_error(APLOG_MARK, APLOG_CRIT, s, + ap_log_error(APLOG_MARK, APLOG_CRIT, errno, s, "unable to replace stdin with sock device driver"); fflush(stdout); if (dup2(fileno(sock_fp), STDOUT_FILENO) == -1) - ap_log_error(APLOG_MARK, APLOG_CRIT, s, + ap_log_error(APLOG_MARK, APLOG_CRIT, errno, s, "unable to replace stdout with sock device driver"); input_parms.generation = ap_my_generation; #ifdef SCOREBOARD_FILE diff --git a/os/unix/unixd.c b/os/unix/unixd.c index bc0153e7f7..0253fda0d4 100644 --- a/os/unix/unixd.c +++ b/os/unix/unixd.c @@ -353,7 +353,7 @@ API_EXPORT(void) unixd_set_rlimit(cmd_parms *cmd, struct rlimit **plimit, limit = *plimit; if ((getrlimit(type, limit)) != 0) { *plimit = NULL; - ap_log_error(APLOG_MARK, APLOG_ERR, 0, cmd->server, + ap_log_error(APLOG_MARK, APLOG_ERR, errno, cmd->server, "%s: getrlimit failed", cmd->cmd->name); return; } diff --git a/server/connection.c b/server/connection.c index 1d20ee463c..c975038ee8 100644 --- a/server/connection.c +++ b/server/connection.c @@ -118,7 +118,7 @@ static void sock_enable_linger(int s) if (setsockopt(s, SOL_SOCKET, SO_LINGER, (char *) &li, sizeof(struct linger)) < 0) { - ap_log_error(APLOG_MARK, APLOG_WARNING, server_conf, + ap_log_error(APLOG_MARK, APLOG_WARNING, errno, server_conf, "setsockopt: (SO_LINGER)"); /* not a fatal error */ } diff --git a/server/mpm/mpmt_pthread/mpmt_pthread.c b/server/mpm/mpmt_pthread/mpmt_pthread.c index 4d24efce6c..dbece3e21b 100644 --- a/server/mpm/mpmt_pthread/mpmt_pthread.c +++ b/server/mpm/mpmt_pthread/mpmt_pthread.c @@ -761,7 +761,7 @@ static int make_child(server_rec *s, int slot, time_t now) int status = bindprocessor(BINDPROCESS, (int)getpid(), PROCESSOR_CLASS_ANY); if (status != OK) - ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_WARNING, ap_server_conf, + ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_WARNING, errno, ap_server_conf, "processor unbind failed %d", status); #endif diff --git a/server/util.c b/server/util.c index 1bab22d7be..09e9758335 100644 --- a/server/util.c +++ b/server/util.c @@ -824,7 +824,7 @@ API_EXPORT(const char *) ap_resolve_env(ap_pool_t *p, const char * word) API_EXPORT(int) ap_cfg_closefile(configfile_t *cfp) { #ifdef DEBUG - ap_log_error(APLOG_MARK, APLOG_DEBUG|APLOG_NOERRNO, NULL, + ap_log_error(APLOG_MARK, APLOG_DEBUG|APLOG_NOERRNO, 0, NULL, "Done with config file %s", cfp->name); #endif return (cfp->close == NULL) ? 0 : cfp->close(cfp->param); @@ -879,7 +879,7 @@ API_EXPORT(ap_status_t) ap_pcfg_openfile(configfile_t **ret_cfg, ap_pool_t *p, c status = ap_open(&file, name, APR_READ | APR_BUFFERED, APR_OS_DEFAULT, p); #ifdef DEBUG - ap_log_error(APLOG_MARK, APLOG_DEBUG | APLOG_NOERRNO, NULL, + ap_log_error(APLOG_MARK, APLOG_DEBUG | APLOG_NOERRNO, 0, NULL, "Opening config file %s (%s)", name, (status != APR_SUCCESS) ? ap_strerror(status, buf, sizeof(buf)) : "successful"); @@ -927,7 +927,7 @@ API_EXPORT(configfile_t *) ap_pcfg_open_custom(ap_pool_t *p, const char *descr, { configfile_t *new_cfg = ap_palloc(p, sizeof(*new_cfg)); #ifdef DEBUG - ap_log_error(APLOG_MARK, APLOG_DEBUG | APLOG_NOERRNO, NULL, "Opening config handler %s", descr); + ap_log_error(APLOG_MARK, APLOG_DEBUG | APLOG_NOERRNO, 0, NULL, "Opening config handler %s", descr); #endif new_cfg->param = param; new_cfg->name = descr; @@ -1016,7 +1016,7 @@ API_EXPORT(int) ap_cfg_getline(char *buf, size_t bufsize, configfile_t *cfp) ; #ifdef DEBUG_CFG_LINES - ap_log_error(APLOG_MARK, APLOG_DEBUG|APLOG_NOERRNO, NULL, "Read config: %s", buf); + ap_log_error(APLOG_MARK, APLOG_DEBUG|APLOG_NOERRNO, 0, NULL, "Read config: %s", buf); #endif return 0; } else { @@ -1073,7 +1073,7 @@ API_EXPORT(int) ap_cfg_getline(char *buf, size_t bufsize, configfile_t *cfp) --i; buf[i] = '\0'; #ifdef DEBUG_CFG_LINES - ap_log_error(APLOG_MARK, APLOG_DEBUG|APLOG_NOERRNO, NULL, "Read config: %s", buf); + ap_log_error(APLOG_MARK, APLOG_DEBUG|APLOG_NOERRNO, 0, NULL, "Read config: %s", buf); #endif return 0; } diff --git a/server/util_uri.c b/server/util_uri.c index bef8108e2e..6d6a39bd56 100644 --- a/server/util_uri.c +++ b/server/util_uri.c @@ -272,7 +272,7 @@ API_EXPORT(void) ap_util_uri_init(void) /* Make a readable error message */ ret = regerror(ret, &re_uri, line, sizeof line); - ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, NULL, + ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, 0, NULL, "Internal error: regcomp(\"%s\") returned non-zero (%s) - " "possibly due to broken regex lib! " "Did you define WANTHSREGEX=yes?", @@ -291,7 +291,7 @@ API_EXPORT(void) ap_util_uri_init(void) /* Make a readable error message */ ret = regerror(ret, &re_hostpart, line, sizeof line); - ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, NULL, + ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, 0, NULL, "Internal error: regcomp(\"%s\") returned non-zero (%s) - " "possibly due to broken regex lib! " "Did you define WANTHSREGEX=yes?", @@ -327,7 +327,7 @@ API_EXPORT(int) ap_parse_uri_components(ap_pool_t *p, const char *uri, uri_compo ret = ap_regexec(&re_uri, uri, re_uri.re_nsub + 1, match, 0); if (ret != 0) { - ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, NULL, + ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, 0, NULL, "ap_regexec() could not parse uri (\"%s\")", uri); @@ -356,7 +356,7 @@ API_EXPORT(int) ap_parse_uri_components(ap_pool_t *p, const char *uri, uri_compo /* Parse the hostinfo part to extract user, password, host, and port */ ret = ap_regexec(&re_hostpart, uptr->hostinfo, re_hostpart.re_nsub + 1, match, 0); if (ret != 0) { - ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, NULL, + ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, 0, NULL, "ap_regexec() could not parse (\"%s\") as host part", uptr->hostinfo); -- 2.50.1