1
0
mirror of https://github.com/apache/httpd.git synced 2025-08-07 04:02:58 +03:00

The lots of little ones... APR_IS_STATUS_condition(rv) conditional macros

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
This commit is contained in:
William A. Rowe Jr
2000-10-05 17:33:14 +00:00
parent 73369a1dce
commit 01f4c4f960
10 changed files with 28 additions and 31 deletions

View File

@@ -2709,7 +2709,7 @@ API_EXPORT(long) ap_send_fb_length(BUFF *fb, request_rec *r, long length)
(void) ap_rflush(r); (void) ap_rflush(r);
break; break;
} }
else if (apr_canonical_error(read_rv) != APR_EAGAIN) { else if (!APR_STATUS_IS_EAGAIN(read_rv)) {
r->connection->aborted = 1; r->connection->aborted = 1;
break; break;
} }

View File

@@ -210,7 +210,7 @@ static int get_path_info(request_rec *r)
char *path = r->filename; char *path = r->filename;
char *end = &path[strlen(path)]; char *end = &path[strlen(path)];
char *last_cp = NULL; char *last_cp = NULL;
int rv, rvc; int rv;
#ifdef HAVE_DRIVE_LETTERS #ifdef HAVE_DRIVE_LETTERS
char bStripSlash=1; char bStripSlash=1;
#endif #endif
@@ -301,10 +301,9 @@ static int get_path_info(request_rec *r)
* even if they returned an error. * even if they returned an error.
*/ */
r->finfo.protection = 0; r->finfo.protection = 0;
rvc = apr_canonical_error(rv);
#if defined(APR_ENOENT) && defined(APR_ENOTDIR) #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; last_cp = cp;
while (--cp > path && *cp != '/') while (--cp > path && *cp != '/')
@@ -315,14 +314,14 @@ static int get_path_info(request_rec *r)
} }
else { else {
#if defined(APR_EACCES) #if defined(APR_EACCES)
if (rvc != APR_EACCES) if (APR_STATUS_IS_EACCES(rv))
#endif #endif
ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r, ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r,
"access to %s failed", r->uri); "access to %s failed", r->uri);
return HTTP_FORBIDDEN; return HTTP_FORBIDDEN;
} }
#else #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. #error comments at this line in the source for a workaround.
/* /*
* If ENOENT || ENOTDIR is not defined in one of the your OS's * 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] == '/') while (cp > path && cp[-1] == '/')
--cp; --cp;
#endif /* ENOENT && ENOTDIR */ #endif /* APR_ENOENT && APR_ENOTDIR */
} }
return OK; return OK;
} }

View File

@@ -1447,9 +1447,7 @@ int ap_parse_htaccess(void **result, request_rec *r, int override,
*result = dc; *result = dc;
break; break;
} else { } else {
apr_status_t cerr = apr_canonical_error(status); if (!APR_STATUS_IS_ENOENT(status) && !APR_STATUS_IS_ENOTDIR(status)) {
if (cerr != APR_ENOENT && cerr != APR_ENOTDIR) {
ap_log_rerror(APLOG_MARK, APLOG_CRIT, status, r, ap_log_rerror(APLOG_MARK, APLOG_CRIT, status, r,
"%s pcfg_openfile: unable to check htaccess file, " "%s pcfg_openfile: unable to check htaccess file, "
"ensure it is readable", "ensure it is readable",

View File

@@ -481,7 +481,7 @@ static void check_pipe_of_death(void)
apr_ssize_t n = 1; apr_ssize_t n = 1;
ret = apr_recv(listenfds[0], &pipe_read_char, &n); 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 /* It lost the lottery. It must continue to suffer
* through a life of servitude. */ * through a life of servitude. */
} }
@@ -555,7 +555,7 @@ static void *worker_thread(void *arg)
srv = apr_poll(pollset, &n, -1); srv = apr_poll(pollset, &n, -1);
if (srv != APR_SUCCESS) { if (srv != APR_SUCCESS) {
if (apr_canonical_error(srv) == APR_EINTR) { if (APR_STATUS_IS_EINTR(srv)) {
continue; 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 */ /* give the children the signal to die */
for (i = 0; i < num_daemons;) { for (i = 0; i < num_daemons;) {
if ((rv = apr_write(pipe_of_death_out, &char_of_death, &one)) != APR_SUCCESS) { 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, ap_log_error(APLOG_MARK, APLOG_WARNING, rv, ap_server_conf,
"write pipe_of_death"); "write pipe_of_death");
} }

View File

@@ -518,7 +518,7 @@ static void check_pipe_of_death(void)
apr_ssize_t n = 1; apr_ssize_t n = 1;
ret = apr_recv(listenfds[0], &pipe_read_char, &n); 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 /* It lost the lottery. It must continue to suffer
* through a life of servitude. */ * through a life of servitude. */
} }
@@ -593,7 +593,7 @@ static void *worker_thread(void *arg)
srv = apr_poll(pollset, &n, -1); srv = apr_poll(pollset, &n, -1);
if (srv != APR_SUCCESS) { if (srv != APR_SUCCESS) {
if (apr_canonical_error(srv) == APR_EINTR) { if (APR_STATUS_IS_EINTR(srv)) {
continue; 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 */ /* give the children the signal to die */
for (i = 0; i < num_daemons;) { for (i = 0; i < num_daemons;) {
if ((rv = apr_write(pipe_of_death_out, &char_of_death, &one)) != APR_SUCCESS) { 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, ap_log_error(APLOG_MARK, APLOG_WARNING, rv, ap_server_conf,
"write pipe_of_death"); "write pipe_of_death");
} }

View File

@@ -432,7 +432,7 @@ static void check_pipe_of_death(void)
apr_ssize_t n = 1; apr_ssize_t n = 1;
ret = apr_recv(listensocks[0], &pipe_read_char, &n); 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 /* It lost the lottery. It must continue to suffer
* through a life of servitude. */ * through a life of servitude. */
} }
@@ -498,7 +498,7 @@ static void * worker_thread(void * dummy)
ret = apr_poll(pollset, &n, -1); ret = apr_poll(pollset, &n, -1);
if (ret != APR_SUCCESS) { if (ret != APR_SUCCESS) {
if (apr_canonical_error(ret) == APR_EINTR) { if (APR_STATUS_IS_EINTR(ret)) {
continue; 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 */ /* give the children the signal to die */
for (i = 0; i < ap_daemons_limit;) { for (i = 0; i < ap_daemons_limit;) {
if ((rv = apr_write(pipe_of_death_in, &char_of_death, &one)) != APR_SUCCESS) { 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"); ap_log_error(APLOG_MARK, APLOG_WARNING, rv, ap_server_conf, "write pipe_of_death");
} }
i++; i++;

View File

@@ -518,7 +518,7 @@ static void check_pipe_of_death(void)
apr_ssize_t n = 1; apr_ssize_t n = 1;
ret = apr_recv(listenfds[0], &pipe_read_char, &n); 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 /* It lost the lottery. It must continue to suffer
* through a life of servitude. */ * through a life of servitude. */
} }
@@ -593,7 +593,7 @@ static void *worker_thread(void *arg)
srv = apr_poll(pollset, &n, -1); srv = apr_poll(pollset, &n, -1);
if (srv != APR_SUCCESS) { if (srv != APR_SUCCESS) {
if (apr_canonical_error(srv) == APR_EINTR) { if (APR_STATUS_IS_EINTR(srv)) {
continue; 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 */ /* give the children the signal to die */
for (i = 0; i < num_daemons;) { for (i = 0; i < num_daemons;) {
if ((rv = apr_write(pipe_of_death_out, &char_of_death, &one)) != APR_SUCCESS) { 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, ap_log_error(APLOG_MARK, APLOG_WARNING, rv, ap_server_conf,
"write pipe_of_death"); "write pipe_of_death");
} }

View File

@@ -191,11 +191,11 @@ void ap_wait_or_timeout(apr_wait_t *status, apr_proc_t *ret, apr_pool_t *p)
#endif #endif
} }
rv = apr_wait_all_procs(ret, status, APR_NOWAIT, p); 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; ret->pid = -1;
return; return;
} }
if (rv == APR_CHILD_DONE) { if (APR_STATUS_IS_CHILD_DONE(rv)) {
return; return;
} }
#ifdef NEED_WAITPID #ifdef NEED_WAITPID

View 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_ssize_t j = strlen(buffer + i);
apr_status_t status; apr_status_t status;
status = apr_send(sock, buffer+i, &j); 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, ap_log_error(APLOG_MARK, APLOG_CRIT, status, srv,
"write: rfc1413: error sending request"); "write: rfc1413: error sending request");
return -1; 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_ssize_t j = sizeof(buffer) - 1 - i;
apr_status_t status; apr_status_t status;
status = apr_recv(sock, buffer+i, &j); 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, ap_log_error(APLOG_MARK, APLOG_CRIT, status, srv,
"read: rfc1413: error reading response"); "read: rfc1413: error reading response");
return -1; return -1;

View File

@@ -498,7 +498,7 @@ static void start_connect(struct connection *c)
} }
c->start = apr_now(); c->start = apr_now();
if ((rv = apr_connect(c->aprsock, hostname)) != APR_SUCCESS) { 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; c->state = STATE_CONNECTING;
apr_add_poll_socket(readbits, c->aprsock, APR_POLLOUT); apr_add_poll_socket(readbits, c->aprsock, APR_POLLOUT);
return; return;
@@ -574,13 +574,13 @@ static void read_connection(struct connection *c)
r = sizeof(buffer); r = sizeof(buffer);
apr_setsocketopt(c->aprsock, APR_SO_TIMEOUT, aprtimeout); apr_setsocketopt(c->aprsock, APR_SO_TIMEOUT, aprtimeout);
status = apr_recv(c->aprsock, buffer, &r); 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++; good++;
close_connection(c); close_connection(c);
return; return;
} }
if (apr_canonical_error(status) == APR_EAGAIN) if (APR_STATUS_IS_EAGAIN(status))
return; return;
c->read += r; c->read += r;
@@ -862,14 +862,14 @@ static void test(void)
static void copyright(void) static void copyright(void)
{ {
if (!use_html) { 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) 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("Copyright (c) 1998-2000 The Apache Software Foundation, http://www.apache.org/\n");
printf("\n"); printf("\n");
} }
else { else {
printf("<p>\n"); 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) 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(" Copyright (c) 1998-2000 The Apache Software Foundation, http://www.apache.org/<br>\n");
printf("</p>\n<p>\n"); printf("</p>\n<p>\n");