]> granicus.if.org Git - apache/commitdiff
The lots of little ones... APR_IS_STATUS_condition(rv) conditional macros
authorWilliam A. Rowe Jr <wrowe@apache.org>
Thu, 5 Oct 2000 17:33:14 +0000 (17:33 +0000)
committerWilliam A. Rowe Jr <wrowe@apache.org>
Thu, 5 Oct 2000 17:33:14 +0000 (17:33 +0000)
  replacing the majority of fallible rv == APR_condition tests.  But there
  are lots more to fix, these are the obvious ones that already did proper
  canonical error conversion.

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@86405 13f79535-47bb-0310-9956-ffa450edef68

modules/http/http_protocol.c
modules/http/http_request.c
server/config.c
server/mpm/dexter/dexter.c
server/mpm/experimental/perchild/perchild.c
server/mpm/mpmt_pthread/mpmt_pthread.c
server/mpm/perchild/perchild.c
server/mpm_common.c
server/rfc1413.c
support/ab.c

index 2b39f0561364b75232a1d7ddee999195f8a41c39..645459e05681d05e9a6f00181bf365f97bbabc8d 100644 (file)
@@ -2709,7 +2709,7 @@ API_EXPORT(long) ap_send_fb_length(BUFF *fb, request_rec *r, long length)
             (void) ap_rflush(r);
             break;
         }
-        else if (apr_canonical_error(read_rv) != APR_EAGAIN) {
+        else if (!APR_STATUS_IS_EAGAIN(read_rv)) {
             r->connection->aborted = 1;
             break;
         }
index 7b86159165e79727655256836cf1c16d2f87303d..fb1ab0e66398016ff3ea8bd796ff94b1f8b63bd8 100644 (file)
@@ -210,7 +210,7 @@ static int get_path_info(request_rec *r)
     char *path = r->filename;
     char *end = &path[strlen(path)];
     char *last_cp = NULL;
-    int rv, rvc;
+    int rv;
 #ifdef HAVE_DRIVE_LETTERS
     char bStripSlash=1;
 #endif
@@ -301,10 +301,9 @@ static int get_path_info(request_rec *r)
         * even if they returned an error.
         */
        r->finfo.protection = 0;
-       rvc = apr_canonical_error(rv);
 
 #if defined(APR_ENOENT) && defined(APR_ENOTDIR)
-        if (rvc == APR_ENOENT || rvc == APR_ENOTDIR) {
+        if (APR_STATUS_IS_ENOENT(rv) || APR_STATUS_IS_ENOTDIR(rv)) {
             last_cp = cp;
 
             while (--cp > path && *cp != '/')
@@ -315,14 +314,14 @@ static int get_path_info(request_rec *r)
         }
         else {
 #if defined(APR_EACCES)
-            if (rvc != APR_EACCES)
+            if (APR_STATUS_IS_EACCES(rv))
 #endif
                 ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r,
                             "access to %s failed", r->uri);
             return HTTP_FORBIDDEN;
         }
 #else
-#error ENOENT || ENOTDIR not defined; please see the
+#error APR_ENOENT || APR_ENOTDIR not defined; please see the
 #error comments at this line in the source for a workaround.
         /*
          * If ENOENT || ENOTDIR is not defined in one of the your OS's
@@ -344,7 +343,7 @@ static int get_path_info(request_rec *r)
 
        while (cp > path && cp[-1] == '/')
            --cp;
-#endif  /* ENOENT && ENOTDIR */
+#endif  /* APR_ENOENT && APR_ENOTDIR */
     }
     return OK;
 }
index b1a3d8982dbed3050a8c91342fb3325ee66ff6a7..f965592cc097279d498b4da92bb7655f2aa8c349 100644 (file)
@@ -1447,9 +1447,7 @@ int ap_parse_htaccess(void **result, request_rec *r, int override,
             *result = dc;
             break;
         } else {
-           apr_status_t cerr = apr_canonical_error(status);
-
-           if (cerr != APR_ENOENT && cerr != APR_ENOTDIR) {
+           if (!APR_STATUS_IS_ENOENT(status) && !APR_STATUS_IS_ENOTDIR(status)) {
                ap_log_rerror(APLOG_MARK, APLOG_CRIT, status, r,
                              "%s pcfg_openfile: unable to check htaccess file, "
                              "ensure it is readable",
index e844fed028f3a19fb8229d6760f363597d743635..006435c8cc7bb025ddf96f1c4df1d0714a6e3ece 100644 (file)
@@ -481,7 +481,7 @@ static void check_pipe_of_death(void)
         apr_ssize_t n = 1;
 
         ret = apr_recv(listenfds[0], &pipe_read_char, &n);
-        if (apr_canonical_error(ret) == APR_EAGAIN) {
+        if (APR_STATUS_IS_EAGAIN(ret)) {
             /* It lost the lottery. It must continue to suffer
              * through a life of servitude. */
         }
@@ -555,7 +555,7 @@ static void *worker_thread(void *arg)
             srv = apr_poll(pollset, &n, -1);
 
             if (srv != APR_SUCCESS) {
-                if (apr_canonical_error(srv) == APR_EINTR) {
+                if (APR_STATUS_IS_EINTR(srv)) {
                     continue;
                 }
 
@@ -1112,7 +1112,7 @@ int ap_mpm_run(apr_pool_t *_pconf, apr_pool_t *plog, server_rec *s)
        /* give the children the signal to die */
         for (i = 0; i < num_daemons;) {
             if ((rv = apr_write(pipe_of_death_out, &char_of_death, &one)) != APR_SUCCESS) {
-                if (apr_canonical_error(rv) == APR_EINTR) continue;
+                if (APR_STATUS_IS_EINTR(rv)) continue;
                 ap_log_error(APLOG_MARK, APLOG_WARNING, rv, ap_server_conf,
                              "write pipe_of_death");
             }
index 8775d6bd5ed35681f256fe9bc14427a7d98ea13e..f62b7378737a59f3f32f1fba370bd42bc2377ed5 100644 (file)
@@ -518,7 +518,7 @@ static void check_pipe_of_death(void)
         apr_ssize_t n = 1;
 
         ret = apr_recv(listenfds[0], &pipe_read_char, &n);
-        if (apr_canonical_error(ret) == APR_EAGAIN) {
+        if (APR_STATUS_IS_EAGAIN(ret)) {
             /* It lost the lottery. It must continue to suffer
              * through a life of servitude. */
         }
@@ -593,7 +593,7 @@ static void *worker_thread(void *arg)
             srv = apr_poll(pollset, &n, -1);
 
             if (srv != APR_SUCCESS) {
-                if (apr_canonical_error(srv) == APR_EINTR) {
+                if (APR_STATUS_IS_EINTR(srv)) {
                     continue;
                 }
 
@@ -1272,7 +1272,7 @@ int ap_mpm_run(apr_pool_t *_pconf, apr_pool_t *plog, server_rec *s)
        /* give the children the signal to die */
         for (i = 0; i < num_daemons;) {
             if ((rv = apr_write(pipe_of_death_out, &char_of_death, &one)) != APR_SUCCESS) {
-                if (apr_canonical_error(rv) == APR_EINTR) continue;
+                if (APR_STATUS_IS_EINTR(rv)) continue;
                 ap_log_error(APLOG_MARK, APLOG_WARNING, rv, ap_server_conf,
                              "write pipe_of_death");
             }
index 79da49018c75478a1637a0ee1e931fc4deba8e89..c3c2652850aa2b523fc79dbc5ec25c9b201eb586 100644 (file)
@@ -432,7 +432,7 @@ static void check_pipe_of_death(void)
        apr_ssize_t n = 1;
 
         ret = apr_recv(listensocks[0], &pipe_read_char, &n);
-        if (apr_canonical_error(ret) == APR_EAGAIN) {
+        if (APR_STATUS_IS_EAGAIN(ret)) {
             /* It lost the lottery. It must continue to suffer
              * through a life of servitude. */
         }
@@ -498,7 +498,7 @@ static void * worker_thread(void * dummy)
 
             ret = apr_poll(pollset, &n, -1);
             if (ret != APR_SUCCESS) {
-                if (apr_canonical_error(ret) == APR_EINTR) {
+                if (APR_STATUS_IS_EINTR(ret)) {
                     continue;
                 }
 
@@ -1133,7 +1133,7 @@ int ap_mpm_run(apr_pool_t *_pconf, apr_pool_t *plog, server_rec *s)
        /* give the children the signal to die */
         for (i = 0; i < ap_daemons_limit;) {
             if ((rv = apr_write(pipe_of_death_in, &char_of_death, &one)) != APR_SUCCESS) {
-                if (apr_canonical_error(rv) == APR_EINTR) continue;
+                if (APR_STATUS_IS_EINTR(rv)) continue;
                 ap_log_error(APLOG_MARK, APLOG_WARNING, rv, ap_server_conf, "write pipe_of_death");
             }
             i++;
index 8775d6bd5ed35681f256fe9bc14427a7d98ea13e..f62b7378737a59f3f32f1fba370bd42bc2377ed5 100644 (file)
@@ -518,7 +518,7 @@ static void check_pipe_of_death(void)
         apr_ssize_t n = 1;
 
         ret = apr_recv(listenfds[0], &pipe_read_char, &n);
-        if (apr_canonical_error(ret) == APR_EAGAIN) {
+        if (APR_STATUS_IS_EAGAIN(ret)) {
             /* It lost the lottery. It must continue to suffer
              * through a life of servitude. */
         }
@@ -593,7 +593,7 @@ static void *worker_thread(void *arg)
             srv = apr_poll(pollset, &n, -1);
 
             if (srv != APR_SUCCESS) {
-                if (apr_canonical_error(srv) == APR_EINTR) {
+                if (APR_STATUS_IS_EINTR(srv)) {
                     continue;
                 }
 
@@ -1272,7 +1272,7 @@ int ap_mpm_run(apr_pool_t *_pconf, apr_pool_t *plog, server_rec *s)
        /* give the children the signal to die */
         for (i = 0; i < num_daemons;) {
             if ((rv = apr_write(pipe_of_death_out, &char_of_death, &one)) != APR_SUCCESS) {
-                if (apr_canonical_error(rv) == APR_EINTR) continue;
+                if (APR_STATUS_IS_EINTR(rv)) continue;
                 ap_log_error(APLOG_MARK, APLOG_WARNING, rv, ap_server_conf,
                              "write pipe_of_death");
             }
index d77c66244092a3e3604a98939c916b26fc81f134..e9e2727e8487ffe7f2e24a768544d03692af8d0b 100644 (file)
@@ -191,11 +191,11 @@ void ap_wait_or_timeout(apr_wait_t *status, apr_proc_t *ret, apr_pool_t *p)
 #endif
     }
     rv = apr_wait_all_procs(ret, status, APR_NOWAIT, p);
-    if (apr_canonical_error(rv) == APR_EINTR) {
+    if (APR_STATUS_IS_EINTR(rv)) {
         ret->pid = -1;
         return;
     }
-    if (rv == APR_CHILD_DONE) {
+    if (APR_STATUS_IS_CHILD_DONE(rv)) {
         return;
     }
 #ifdef NEED_WAITPID
index ce1758ff9d4e405cde530eeefd911527ab104b18..7a8cc102f688eff438db1e76337b6edac99a71c1 100644 (file)
@@ -168,7 +168,7 @@ static int get_rfc1413(apr_socket_t *sock, const char *local_ip,
         apr_ssize_t j = strlen(buffer + i);
         apr_status_t status;
        status  = apr_send(sock, buffer+i, &j);
-       if (status != APR_SUCCESS && apr_canonical_error(status) != APR_EINTR) {
+       if (status != APR_SUCCESS && !APR_STATUS_IS_EINTR(status)) {
            ap_log_error(APLOG_MARK, APLOG_CRIT, status, srv,
                         "write: rfc1413: error sending request");
            return -1;
@@ -194,7 +194,7 @@ static int get_rfc1413(apr_socket_t *sock, const char *local_ip,
         apr_ssize_t j = sizeof(buffer) - 1 - i;
         apr_status_t status;
        status = apr_recv(sock, buffer+i, &j);
-       if (status != APR_SUCCESS && apr_canonical_error(status) != APR_EINTR) {
+       if (status != APR_SUCCESS && !APR_STATUS_IS_EINTR(status)) {
            ap_log_error(APLOG_MARK, APLOG_CRIT, status, srv,
                        "read: rfc1413: error reading response");
            return -1;
index 688c4568665a5de3b58e3dab9c98b8dae887d7c9..9752ec042d288a989f151d18a70591a6b2809918 100644 (file)
@@ -498,7 +498,7 @@ static void start_connect(struct connection *c)
     }
     c->start = apr_now();
     if ((rv = apr_connect(c->aprsock, hostname)) != APR_SUCCESS) {
-        if (apr_canonical_error(rv) == APR_EINPROGRESS) {
+        if (APR_STATUS_IS_EINPROGRESS(rv)) {
             c->state = STATE_CONNECTING;
             apr_add_poll_socket(readbits, c->aprsock, APR_POLLOUT);
             return;
@@ -574,13 +574,13 @@ static void read_connection(struct connection *c)
     r = sizeof(buffer);
     apr_setsocketopt(c->aprsock, APR_SO_TIMEOUT, aprtimeout);
     status = apr_recv(c->aprsock, buffer, &r);
-    if (r == 0 || (status != 0 && apr_canonical_error(status) != APR_EAGAIN)) {
+    if (r == 0 || (status != APR_SUCCESS && !APR_STATUS_IS_EAGAIN(status))) {
         good++;
         close_connection(c);
         return;
     }
 
-    if (apr_canonical_error(status) == APR_EAGAIN)
+    if (APR_STATUS_IS_EAGAIN(status))
         return;
 
     c->read += r;
@@ -862,14 +862,14 @@ static void test(void)
 static void copyright(void)
 {
     if (!use_html) {
-        printf("This is ApacheBench, Version %s\n", AB_VERSION " <$Revision: 1.27 $> apache-2.0");
+        printf("This is ApacheBench, Version %s\n", AB_VERSION " <$Revision: 1.28 $> apache-2.0");
         printf("Copyright (c) 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/\n");
         printf("Copyright (c) 1998-2000 The Apache Software Foundation, http://www.apache.org/\n");
         printf("\n");
     }
     else {
         printf("<p>\n");
-        printf(" This is ApacheBench, Version %s <i>&lt;%s&gt;</i> apache-2.0<br>\n", AB_VERSION, "$Revision: 1.27 $");
+        printf(" This is ApacheBench, Version %s <i>&lt;%s&gt;</i> apache-2.0<br>\n", AB_VERSION, "$Revision: 1.28 $");
         printf(" Copyright (c) 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/<br>\n");
         printf(" Copyright (c) 1998-2000 The Apache Software Foundation, http://www.apache.org/<br>\n");
         printf("</p>\n<p>\n");