summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Fritsch <sf@apache.org>2013-03-31 23:29:28 +0200
committerStefan Fritsch <sf@apache.org>2013-03-31 23:29:28 +0200
commite00688ffd945257f24f92e5465f63ac7efa4a435 (patch)
tree12191b3bc6ec616e0394ec0ccf736ee96139250d
parentuse ap_log_error's facility to print the apr error string instead of (diff)
downloadapache2-e00688ffd945257f24f92e5465f63ac7efa4a435.tar.xz
apache2-e00688ffd945257f24f92e5465f63ac7efa4a435.zip
Use %pm available since apr 1.3 instead of an extra call to apr_strerror
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1463056 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--modules/aaa/mod_access_compat.c10
-rw-r--r--modules/filters/mod_ext_filter.c5
-rw-r--r--modules/generators/mod_cgi.c5
-rw-r--r--modules/metadata/mod_remoteip.c12
-rw-r--r--modules/session/mod_session_crypto.c5
-rw-r--r--server/config.c15
6 files changed, 20 insertions, 32 deletions
diff --git a/modules/aaa/mod_access_compat.c b/modules/aaa/mod_access_compat.c
index 8d7afca19f..46d8da0e53 100644
--- a/modules/aaa/mod_access_compat.c
+++ b/modules/aaa/mod_access_compat.c
@@ -147,7 +147,6 @@ static const char *allow_cmd(cmd_parms *cmd, void *dv, const char *from,
allowdeny *a;
char *where = apr_pstrdup(cmd->pool, where_c);
char *s;
- char msgbuf[120];
apr_status_t rv;
if (strcasecmp(from, "from"))
@@ -178,17 +177,14 @@ static const char *allow_cmd(cmd_parms *cmd, void *dv, const char *from,
return "An IP address was expected";
}
else if (rv != APR_SUCCESS) {
- apr_strerror(rv, msgbuf, sizeof msgbuf);
- return apr_pstrdup(cmd->pool, msgbuf);
+ return apr_psprintf(cmd->pool, "%pm", &rv);
}
a->type = T_IP;
}
else if (!APR_STATUS_IS_EINVAL(rv = apr_ipsubnet_create(&a->x.ip, where,
NULL, cmd->pool))) {
- if (rv != APR_SUCCESS) {
- apr_strerror(rv, msgbuf, sizeof msgbuf);
- return apr_pstrdup(cmd->pool, msgbuf);
- }
+ if (rv != APR_SUCCESS)
+ return apr_psprintf(cmd->pool, "%pm", &rv);
a->type = T_IP;
}
else { /* no slash, didn't look like an IP address => must be a host */
diff --git a/modules/filters/mod_ext_filter.c b/modules/filters/mod_ext_filter.c
index 658c121a0b..bd72526dbb 100644
--- a/modules/filters/mod_ext_filter.c
+++ b/modules/filters/mod_ext_filter.c
@@ -396,7 +396,6 @@ static void child_errfn(apr_pool_t *pool, apr_status_t err, const char *descript
request_rec *r;
void *vr;
apr_file_t *stderr_log;
- char errbuf[200];
char time_str[APR_CTIME_LEN];
apr_pool_userdata_get(&vr, ERRFN_USERDATA_KEY, pool);
@@ -404,11 +403,11 @@ static void child_errfn(apr_pool_t *pool, apr_status_t err, const char *descript
apr_file_open_stderr(&stderr_log, pool);
ap_recent_ctime(time_str, apr_time_now());
apr_file_printf(stderr_log,
- "[%s] [client %s] mod_ext_filter (%d)%s: %s\n",
+ "[%s] [client %s] mod_ext_filter (%d)%pm: %s\n",
time_str,
r->useragent_ip,
err,
- apr_strerror(err, errbuf, sizeof(errbuf)),
+ &err,
description);
}
diff --git a/modules/generators/mod_cgi.c b/modules/generators/mod_cgi.c
index 5a0cb38296..7808262f0f 100644
--- a/modules/generators/mod_cgi.c
+++ b/modules/generators/mod_cgi.c
@@ -354,16 +354,15 @@ static void cgi_child_errfn(apr_pool_t *pool, apr_status_t err,
const char *description)
{
apr_file_t *stderr_log;
- char errbuf[200];
apr_file_open_stderr(&stderr_log, pool);
/* Escape the logged string because it may be something that
* came in over the network.
*/
apr_file_printf(stderr_log,
- "(%d)%s: %s\n",
+ "(%d)%pm: %s\n",
err,
- apr_strerror(err, errbuf, sizeof(errbuf)),
+ &err,
#ifndef AP_UNSAFE_ERROR_LOG_UNESCAPED
ap_escape_logitem(pool,
#endif
diff --git a/modules/metadata/mod_remoteip.c b/modules/metadata/mod_remoteip.c
index a0bfd8644f..79aa6a940a 100644
--- a/modules/metadata/mod_remoteip.c
+++ b/modules/metadata/mod_remoteip.c
@@ -170,10 +170,9 @@ static const char *proxies_set(cmd_parms *cmd, void *cfg,
}
if (rv != APR_SUCCESS) {
- char msgbuf[128];
- apr_strerror(rv, msgbuf, sizeof(msgbuf));
- return apr_pstrcat(cmd->pool, "RemoteIP: Error parsing IP ", arg,
- " (", msgbuf, " error) for ", cmd->cmd->name, NULL);
+ return apr_psprintf(cmd->pool,
+ "RemoteIP: Error parsing IP %s (%pm error) for %s",
+ arg, &rv, cmd->cmd->name);
}
return NULL;
@@ -192,9 +191,8 @@ static const char *proxylist_read(cmd_parms *cmd, void *cfg,
filename = ap_server_root_relative(cmd->temp_pool, filename);
rv = ap_pcfg_openfile(&cfp, cmd->temp_pool, filename);
if (rv != APR_SUCCESS) {
- return apr_psprintf(cmd->pool, "%s: Could not open file %s: %s",
- cmd->cmd->name, filename,
- apr_strerror(rv, lbuf, sizeof(lbuf)));
+ return apr_psprintf(cmd->pool, "%s: Could not open file %s: %pm",
+ cmd->cmd->name, filename, &rv);
}
while (!(ap_cfg_getline(lbuf, MAX_STRING_LEN, cfp))) {
diff --git a/modules/session/mod_session_crypto.c b/modules/session/mod_session_crypto.c
index f48ff0385b..03dbba61d6 100644
--- a/modules/session/mod_session_crypto.c
+++ b/modules/session/mod_session_crypto.c
@@ -556,9 +556,8 @@ static const char *set_crypto_passphrase_file(cmd_parms *cmd, void *config,
filename = ap_server_root_relative(cmd->temp_pool, filename);
rv = ap_pcfg_openfile(&file, cmd->temp_pool, filename);
if (rv != APR_SUCCESS) {
- return apr_psprintf(cmd->pool, "%s: Could not open file %s: %s",
- cmd->cmd->name, filename,
- apr_strerror(rv, buffer, sizeof(buffer)));
+ return apr_psprintf(cmd->pool, "%s: Could not open file %s: %pm",
+ cmd->cmd->name, filename, &rv);
}
while (!(ap_cfg_getline(buffer, sizeof(buffer), file))) {
diff --git a/server/config.c b/server/config.c
index 733d9c285f..465ebf2207 100644
--- a/server/config.c
+++ b/server/config.c
@@ -1802,9 +1802,8 @@ AP_DECLARE(const char *) ap_process_resource_config(server_rec *s,
rv = ap_pcfg_openfile(&cfp, p, fname);
if (rv != APR_SUCCESS) {
- char errmsg[120];
- return apr_psprintf(p, "Could not open configuration file %s: %s",
- fname, apr_strerror(rv, errmsg, sizeof errmsg));
+ return apr_psprintf(p, "Could not open configuration file %s: %pm",
+ fname, &rv);
}
parms.config_file = cfp;
@@ -1859,9 +1858,8 @@ static const char *process_resource_config_nofnmatch(server_rec *s,
*/
rv = apr_dir_open(&dirp, path, ptemp);
if (rv != APR_SUCCESS) {
- char errmsg[120];
- return apr_psprintf(p, "Could not open config directory %s: %s",
- path, apr_strerror(rv, errmsg, sizeof errmsg));
+ return apr_psprintf(p, "Could not open config directory %s: %pm",
+ path, &rv);
}
candidates = apr_array_make(ptemp, 1, sizeof(fnames));
@@ -1946,9 +1944,8 @@ static const char *process_resource_config_fnmatch(server_rec *s,
*/
rv = apr_dir_open(&dirp, path, ptemp);
if (rv != APR_SUCCESS) {
- char errmsg[120];
- return apr_psprintf(p, "Could not open config directory %s: %s",
- path, apr_strerror(rv, errmsg, sizeof errmsg));
+ return apr_psprintf(p, "Could not open config directory %s: %pm",
+ path, &rv);
}
candidates = apr_array_make(ptemp, 1, sizeof(fnames));