httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s.@apache.org
Subject svn commit: r1463056 - in /httpd/httpd/trunk: modules/aaa/mod_access_compat.c modules/filters/mod_ext_filter.c modules/generators/mod_cgi.c modules/metadata/mod_remoteip.c modules/session/mod_session_crypto.c server/config.c
Date Sun, 31 Mar 2013 21:29:28 GMT
Author: sf
Date: Sun Mar 31 21:29:28 2013
New Revision: 1463056

URL: http://svn.apache.org/r1463056
Log:
Use %pm available since apr 1.3 instead of an extra call to apr_strerror

Modified:
    httpd/httpd/trunk/modules/aaa/mod_access_compat.c
    httpd/httpd/trunk/modules/filters/mod_ext_filter.c
    httpd/httpd/trunk/modules/generators/mod_cgi.c
    httpd/httpd/trunk/modules/metadata/mod_remoteip.c
    httpd/httpd/trunk/modules/session/mod_session_crypto.c
    httpd/httpd/trunk/server/config.c

Modified: httpd/httpd/trunk/modules/aaa/mod_access_compat.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/aaa/mod_access_compat.c?rev=1463056&r1=1463055&r2=1463056&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/aaa/mod_access_compat.c (original)
+++ httpd/httpd/trunk/modules/aaa/mod_access_compat.c Sun Mar 31 21:29:28 2013
@@ -147,7 +147,6 @@ static const char *allow_cmd(cmd_parms *
     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 *
             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 */

Modified: httpd/httpd/trunk/modules/filters/mod_ext_filter.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/filters/mod_ext_filter.c?rev=1463056&r1=1463055&r2=1463056&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/filters/mod_ext_filter.c (original)
+++ httpd/httpd/trunk/modules/filters/mod_ext_filter.c Sun Mar 31 21:29:28 2013
@@ -396,7 +396,6 @@ static void child_errfn(apr_pool_t *pool
     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_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);
 }
 

Modified: httpd/httpd/trunk/modules/generators/mod_cgi.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/generators/mod_cgi.c?rev=1463056&r1=1463055&r2=1463056&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/generators/mod_cgi.c (original)
+++ httpd/httpd/trunk/modules/generators/mod_cgi.c Sun Mar 31 21:29:28 2013
@@ -354,16 +354,15 @@ static void cgi_child_errfn(apr_pool_t *
                             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

Modified: httpd/httpd/trunk/modules/metadata/mod_remoteip.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/metadata/mod_remoteip.c?rev=1463056&r1=1463055&r2=1463056&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/metadata/mod_remoteip.c (original)
+++ httpd/httpd/trunk/modules/metadata/mod_remoteip.c Sun Mar 31 21:29:28 2013
@@ -170,10 +170,9 @@ static const char *proxies_set(cmd_parms
     }
 
     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_pa
     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))) {

Modified: httpd/httpd/trunk/modules/session/mod_session_crypto.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/session/mod_session_crypto.c?rev=1463056&r1=1463055&r2=1463056&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/session/mod_session_crypto.c (original)
+++ httpd/httpd/trunk/modules/session/mod_session_crypto.c Sun Mar 31 21:29:28 2013
@@ -556,9 +556,8 @@ static const char *set_crypto_passphrase
     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))) {

Modified: httpd/httpd/trunk/server/config.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/server/config.c?rev=1463056&r1=1463055&r2=1463056&view=diff
==============================================================================
--- httpd/httpd/trunk/server/config.c (original)
+++ httpd/httpd/trunk/server/config.c Sun Mar 31 21:29:28 2013
@@ -1802,9 +1802,8 @@ AP_DECLARE(const char *) ap_process_reso
 
     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_conf
          */
         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_conf
      */
     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));



Mime
View raw message