httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jaillet...@apache.org
Subject svn commit: r1464674 - in /httpd/httpd/trunk/support: firehose.c htcacheclean.c
Date Thu, 04 Apr 2013 18:44:02 GMT
Author: jailletc36
Date: Thu Apr  4 18:44:02 2013
New Revision: 1464674

URL: http://svn.apache.org/r1464674
Log:
Use apr_file_printf(... "%pm"...) instead of explicit call to apr_strerror
+ add some spaces to improve formatting

Modified:
    httpd/httpd/trunk/support/firehose.c
    httpd/httpd/trunk/support/htcacheclean.c

Modified: httpd/httpd/trunk/support/firehose.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/support/firehose.c?rev=1464674&r1=1464673&r2=1464674&view=diff
==============================================================================
--- httpd/httpd/trunk/support/firehose.c (original)
+++ httpd/httpd/trunk/support/firehose.c Thu Apr  4 18:44:02 2013
@@ -233,7 +233,6 @@ static apr_status_t finalise_body(file_r
     apr_status_t status;
     char *nfrom, *nto, *from, *to;
     apr_pool_t *pool;
-    char errbuf[HUGE_STRING_LEN];
 
     apr_pool_create(&pool, file->pool);
 
@@ -251,31 +250,27 @@ static apr_status_t finalise_body(file_r
                 if (APR_SUCCESS != (status = apr_file_rename(nfrom, nto, pool))) {
                     apr_file_printf(
                             file->file_err,
-                            "Could not rename file '%s' to '%s' for fragment write: %s\n",
-                            nfrom, nto,
-                            apr_strerror(status, errbuf, sizeof(errbuf)));
+                            "Could not rename file '%s' to '%s' for fragment write: %pm\n",
+                            nfrom, nto, &status);
                 }
             }
             else {
                 apr_file_printf(
                         file->file_err,
-                        "Could not set mtime on file '%s' to '%" APR_TIME_T_FMT "' for fragment
write: %s\n",
-                        nfrom, file->end,
-                        apr_strerror(status, errbuf, sizeof(errbuf)));
+                        "Could not set mtime on file '%s' to '%" APR_TIME_T_FMT "' for fragment
write: %pm\n",
+                        nfrom, file->end, &status);
             }
         }
         else {
             apr_file_printf(file->file_err,
-                    "Could not merge directory '%s' with file '%s': %s\n",
-                    file->directory, to, apr_strerror(status, errbuf,
-                            sizeof(errbuf)));
+                    "Could not merge directory '%s' with file '%s': %pm\n",
+                    file->directory, to, &status);
         }
     }
     else {
         apr_file_printf(file->file_err,
-                "Could not merge directory '%s' with file '%s': %s\n",
-                file->directory, from, apr_strerror(status, errbuf,
-                        sizeof(errbuf)));
+                "Could not merge directory '%s' with file '%s': %pm\n",
+                file->directory, from, &status);
     }
 
     apr_pool_destroy(pool);
@@ -328,7 +323,6 @@ static apr_status_t process_body(file_re
     char *native, *name;
     apr_pool_t *pool;
     apr_file_t *handle;
-    char errbuf[HUGE_STRING_LEN];
 
     if (!file->start) {
         file->start = header->timestamp;
@@ -350,21 +344,20 @@ static apr_status_t process_body(file_re
             if (APR_SUCCESS != (status = apr_file_write_full(handle, str, len,
                     &len))) {
                 apr_file_printf(file->file_err,
-                        "Could not write fragment body to file '%s': %s\n",
-                        native, apr_strerror(status, errbuf, sizeof(errbuf)));
+                        "Could not write fragment body to file '%s': %pm\n",
+                        native, &status);
             }
         }
         else {
             apr_file_printf(file->file_err,
-                    "Could not open file '%s' for fragment write: %s\n",
-                    native, apr_strerror(status, errbuf, sizeof(errbuf)));
+                    "Could not open file '%s' for fragment write: %pm\n",
+                    native, &status);
         }
     }
     else {
         apr_file_printf(file->file_err,
-                "Could not merge directory '%s' with file '%s': %s\n",
-                file->directory, name, apr_strerror(status, errbuf,
-                        sizeof(errbuf)));
+                "Could not merge directory '%s' with file '%s': %pm\n",
+                file->directory, name, &status);
     }
 
     apr_pool_destroy(pool);
@@ -506,7 +499,6 @@ static apr_status_t process_header(file_
  */
 static apr_status_t demux(file_rec *file)
 {
-    char errbuf[HUGE_STRING_LEN];
     apr_size_t len = 0;
     apr_status_t status = APR_SUCCESS;
     apr_bucket *b, *e;
@@ -598,8 +590,7 @@ static apr_status_t demux(file_rec *file
                                 header.len, &e))) {
                             apr_file_printf(
                                     file->file_err,
-                                    "Could not read fragment body from input file: %s\n",
-                                    apr_strerror(status, errbuf, sizeof(errbuf)));
+                                    "Could not read fragment body from input file: %pm\n",
&status);
                             break;
                         }
                         while ((b = APR_BRIGADE_FIRST(bb)) && e != b) {
@@ -644,8 +635,7 @@ static apr_status_t demux(file_rec *file
         }
         else {
             apr_file_printf(file->file_err,
-                    "Could not read fragment header from input file: %s\n",
-                    apr_strerror(status, errbuf, sizeof(errbuf)));
+                    "Could not read fragment header from input file: %pm\n", &status);
             break;
         }
 
@@ -704,8 +694,7 @@ int main(int argc, const char * const ar
                     APR_OS_DEFAULT, pool);
             if (status != APR_SUCCESS) {
                 apr_file_printf(file->file_err,
-                        "Could not open file '%s' for read: %s\n", optarg,
-                        apr_strerror(status, errmsg, sizeof errmsg));
+                        "Could not open file '%s' for read: %pm\n", optarg, &status);
                 return 1;
             }
             break;
@@ -715,8 +704,7 @@ int main(int argc, const char * const ar
             status = apr_stat(&finfo, optarg, APR_FINFO_TYPE, pool);
             if (status != APR_SUCCESS) {
                 apr_file_printf(file->file_err,
-                        "Directory '%s' could not be found: %s\n", optarg,
-                        apr_strerror(status, errmsg, sizeof errmsg));
+                        "Directory '%s' could not be found: %pm\n", optarg, &status);
                 return 1;
             }
             if (finfo.filetype != APR_DIR) {

Modified: httpd/httpd/trunk/support/htcacheclean.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/support/htcacheclean.c?rev=1464674&r1=1464673&r2=1464674&view=diff
==============================================================================
--- httpd/httpd/trunk/support/htcacheclean.c (original)
+++ httpd/httpd/trunk/support/htcacheclean.c Thu Apr  4 18:44:02 2013
@@ -1087,9 +1087,8 @@ static apr_status_t remove_directory(apr
         return rv;
     }
     if (rv != APR_SUCCESS) {
-        char errmsg[120];
-        apr_file_printf(errfile, "Could not open directory %s: %s" APR_EOL_STR,
-                dir, apr_strerror(rv, errmsg, sizeof errmsg));
+        apr_file_printf(errfile, "Could not open directory %s: %pm" APR_EOL_STR,
+                dir, &rv);
         return rv;
     }
 
@@ -1110,10 +1109,9 @@ static apr_status_t remove_directory(apr
             const char *file = apr_pstrcat(pool, dir, "/", dirent.name, NULL);
             rv = apr_file_remove(file, pool);
             if (APR_SUCCESS != rv) {
-                char errmsg[120];
                 apr_file_printf(errfile,
-                        "Could not remove file '%s': %s" APR_EOL_STR, file,
-                        apr_strerror(rv, errmsg, sizeof errmsg));
+                        "Could not remove file '%s': %pm" APR_EOL_STR, file,
+                        &rv);
                 break;
             }
         }
@@ -1127,9 +1125,8 @@ static apr_status_t remove_directory(apr
             rv = APR_SUCCESS;
         }
         if (rv != APR_SUCCESS) {
-            char errmsg[120];
-            apr_file_printf(errfile, "Could not remove directory %s: %s" APR_EOL_STR,
-                    dir, apr_strerror(rv, errmsg, sizeof errmsg));
+            apr_file_printf(errfile, "Could not remove directory %s: %pm" APR_EOL_STR,
+                    dir, &rv);
         }
     }
 
@@ -1151,9 +1148,8 @@ static apr_status_t find_directory(apr_p
 
     rv = apr_dir_open(&dirp, base, pool);
     if (rv != APR_SUCCESS) {
-        char errmsg[120];
-        apr_file_printf(errfile, "Could not open directory %s: %s" APR_EOL_STR,
-                base, apr_strerror(rv, errmsg, sizeof errmsg));
+        apr_file_printf(errfile, "Could not open directory %s: %pm" APR_EOL_STR,
+                base, &rv);
         return rv;
     }
 
@@ -1194,18 +1190,16 @@ static apr_status_t find_directory(apr_p
             remove = apr_pstrcat(pool, base, "/", header, NULL);
             status = apr_file_remove(remove, pool);
             if (status != APR_SUCCESS && !APR_STATUS_IS_ENOENT(status)) {
-                char errmsg[120];
-                apr_file_printf(errfile, "Could not remove file %s: %s" APR_EOL_STR,
-                        remove, apr_strerror(status, errmsg, sizeof errmsg));
+                apr_file_printf(errfile, "Could not remove file %s: %pm" APR_EOL_STR,
+                        remove, &status);
                 rv = status;
             }
 
             remove = apr_pstrcat(pool, base, "/", data, NULL);
             status = apr_file_remove(remove, pool);
             if (status != APR_SUCCESS && !APR_STATUS_IS_ENOENT(status)) {
-                char errmsg[120];
-                apr_file_printf(errfile, "Could not remove file %s: %s" APR_EOL_STR,
-                        remove, apr_strerror(status, errmsg, sizeof errmsg));
+                apr_file_printf(errfile, "Could not remove file %s: %pm" APR_EOL_STR,
+                        remove, &status);
                 rv = status;
             }
 
@@ -1357,7 +1351,6 @@ static void usage_repeated_arg(apr_pool_
 static void log_pid(apr_pool_t *pool, const char *pidfilename, apr_file_t **pidfile)
 {
     apr_status_t status;
-    char errmsg[120];
     pid_t mypid = getpid();
 
     if (APR_SUCCESS == (status = apr_file_open(pidfile, pidfilename,
@@ -1369,9 +1362,8 @@ static void log_pid(apr_pool_t *pool, co
     else {
         if (errfile) {
             apr_file_printf(errfile,
-                            "Could not write the pid file '%s': %s" APR_EOL_STR,
-                            pidfilename,
-                            apr_strerror(status, errmsg, sizeof errmsg));
+                            "Could not write the pid file '%s': %pm" APR_EOL_STR,
+                            pidfilename, &status);
         }
         exit(1);
     }
@@ -1579,8 +1571,8 @@ int main(int argc, const char * const ar
                 }
                 proxypath = apr_pstrdup(pool, arg);
                 if ((status = apr_filepath_set(proxypath, pool)) != APR_SUCCESS) {
-                    usage(apr_psprintf(pool, "Could not set filepath to '%s': %s",
-                                       proxypath, apr_strerror(status, errmsg, sizeof errmsg)));
+                    usage(apr_psprintf(pool, "Could not set filepath to '%s': %pm",
+                                       proxypath, &status));
                 }
                 break;
 
@@ -1680,8 +1672,7 @@ int main(int argc, const char * const ar
     }
 
     if (apr_filepath_get(&path, 0, pool) != APR_SUCCESS) {
-        usage(apr_psprintf(pool, "Could not get the filepath: %s",
-                           apr_strerror(status, errmsg, sizeof errmsg)));
+        usage(apr_psprintf(pool, "Could not get the filepath: %pm", &status));
     }
     baselen = strlen(path);
 



Mime
View raw message