mirror of
https://github.com/apache/httpd.git
synced 2025-08-08 15:02:10 +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:
@@ -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;
|
||||
}
|
||||
|
@@ -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;
|
||||
}
|
||||
|
@@ -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",
|
||||
|
@@ -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");
|
||||
}
|
||||
|
@@ -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");
|
||||
}
|
||||
|
@@ -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++;
|
||||
|
@@ -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");
|
||||
}
|
||||
|
@@ -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
|
||||
|
@@ -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;
|
||||
|
10
support/ab.c
10
support/ab.c
@@ -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><%s></i> apache-2.0<br>\n", AB_VERSION, "$Revision: 1.27 $");
|
||||
printf(" This is ApacheBench, Version %s <i><%s></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");
|
||||
|
Reference in New Issue
Block a user