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

Use APR_STATUS_IS_... in some more cases.

While this is not strictly necessary everywhere, it makes it much easier
to find the problematic cases.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1102124 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Stefan Fritsch
2011-05-11 22:51:46 +00:00
parent d625ae4adb
commit 61a0413706
6 changed files with 10 additions and 10 deletions

View File

@@ -1846,7 +1846,7 @@ static int proxy_ftp_handler(request_rec *r, proxy_worker *worker,
if (use_port) { if (use_port) {
for (;;) { for (;;) {
rv = apr_socket_accept(&data_sock, local_sock, r->pool); rv = apr_socket_accept(&data_sock, local_sock, r->pool);
if (rv == APR_EINTR) { if (APR_STATUS_IS_EINTR(rv)) {
continue; continue;
} }
else if (rv == APR_SUCCESS) { else if (rv == APR_SUCCESS) {

View File

@@ -1371,7 +1371,7 @@ apr_status_t ap_proxygetline(apr_bucket_brigade *bb, char *s, int n, request_rec
if (rv == APR_SUCCESS) { if (rv == APR_SUCCESS) {
*writen = (int) len; *writen = (int) len;
} else if (rv == APR_ENOSPC) { } else if (APR_STATUS_IS_ENOSPC(rv)) {
*writen = n; *writen = n;
} else { } else {
*writen = -1; *writen = -1;

View File

@@ -643,7 +643,7 @@ int ap_signal_server(int *exit_status, apr_pool_t *pconf)
rv = ap_read_pid(pconf, ap_pid_fname, &otherpid); rv = ap_read_pid(pconf, ap_pid_fname, &otherpid);
if (rv != APR_SUCCESS) { if (rv != APR_SUCCESS) {
if (rv != APR_ENOENT) { if (!APR_STATUS_IS_ENOENT(rv)) {
ap_log_error(APLOG_MARK, APLOG_STARTUP, rv, NULL, ap_log_error(APLOG_MARK, APLOG_STARTUP, rv, NULL,
"Error retrieving pid file %s", ap_pid_fname); "Error retrieving pid file %s", ap_pid_fname);
ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL, ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL,

View File

@@ -610,7 +610,7 @@ static int read_request_line(request_rec *r, apr_bucket_brigade *bb)
* buffer before finding the end-of-line. This is only going to * buffer before finding the end-of-line. This is only going to
* happen if it exceeds the configured limit for a request-line. * happen if it exceeds the configured limit for a request-line.
*/ */
if (rv == APR_ENOSPC) { if (APR_STATUS_IS_ENOSPC(rv)) {
r->status = HTTP_REQUEST_URI_TOO_LARGE; r->status = HTTP_REQUEST_URI_TOO_LARGE;
r->proto_num = HTTP_VERSION(1,0); r->proto_num = HTTP_VERSION(1,0);
r->protocol = apr_pstrdup(r->pool, "HTTP/1.0"); r->protocol = apr_pstrdup(r->pool, "HTTP/1.0");
@@ -618,7 +618,7 @@ static int read_request_line(request_rec *r, apr_bucket_brigade *bb)
else if (APR_STATUS_IS_TIMEUP(rv)) { else if (APR_STATUS_IS_TIMEUP(rv)) {
r->status = HTTP_REQUEST_TIME_OUT; r->status = HTTP_REQUEST_TIME_OUT;
} }
else if (rv == APR_EINVAL) { else if (APR_STATUS_IS_EINVAL(rv)) {
r->status = HTTP_BAD_REQUEST; r->status = HTTP_BAD_REQUEST;
} }
return 0; return 0;

View File

@@ -1083,7 +1083,7 @@ static apr_status_t remove_directory(apr_pool_t *pool, const char *dir)
apr_finfo_t dirent; apr_finfo_t dirent;
rv = apr_dir_open(&dirp, dir, pool); rv = apr_dir_open(&dirp, dir, pool);
if (rv == APR_ENOENT) { if (APR_STATUS_IS_ENOENT(rv)) {
return rv; return rv;
} }
if (rv != APR_SUCCESS) { if (rv != APR_SUCCESS) {
@@ -1193,7 +1193,7 @@ static apr_status_t find_directory(apr_pool_t *pool, const char *base,
remove = apr_pstrcat(pool, base, "/", header, NULL); remove = apr_pstrcat(pool, base, "/", header, NULL);
status = apr_file_remove(remove, pool); status = apr_file_remove(remove, pool);
if (status != APR_SUCCESS && status != APR_ENOENT) { if (status != APR_SUCCESS && !APR_STATUS_IS_ENOENT(status)) {
char errmsg[120]; char errmsg[120];
apr_file_printf(errfile, "Could not remove file %s: %s" APR_EOL_STR, apr_file_printf(errfile, "Could not remove file %s: %s" APR_EOL_STR,
remove, apr_strerror(status, errmsg, sizeof errmsg)); remove, apr_strerror(status, errmsg, sizeof errmsg));
@@ -1202,7 +1202,7 @@ static apr_status_t find_directory(apr_pool_t *pool, const char *base,
remove = apr_pstrcat(pool, base, "/", data, NULL); remove = apr_pstrcat(pool, base, "/", data, NULL);
status = apr_file_remove(remove, pool); status = apr_file_remove(remove, pool);
if (status != APR_SUCCESS && status != APR_ENOENT) { if (status != APR_SUCCESS && !APR_STATUS_IS_ENOENT(status)) {
char errmsg[120]; char errmsg[120];
apr_file_printf(errfile, "Could not remove file %s: %s" APR_EOL_STR, apr_file_printf(errfile, "Could not remove file %s: %s" APR_EOL_STR,
remove, apr_strerror(status, errmsg, sizeof errmsg)); remove, apr_strerror(status, errmsg, sizeof errmsg));
@@ -1210,7 +1210,7 @@ static apr_status_t find_directory(apr_pool_t *pool, const char *base,
} }
status = remove_directory(pool, apr_pstrcat(pool, base, "/", vdir, NULL)); status = remove_directory(pool, apr_pstrcat(pool, base, "/", vdir, NULL));
if (status != APR_SUCCESS && status != APR_ENOENT) { if (status != APR_SUCCESS && !APR_STATUS_IS_ENOENT(status)) {
rv = status; rv = status;
} }
} }

View File

@@ -532,7 +532,7 @@ int main(int argc, const char * const argv[])
switch (cmd) { switch (cmd) {
case HTDBM_VERIFY: case HTDBM_VERIFY:
if ((rv = htdbm_verify(h)) != APR_SUCCESS) { if ((rv = htdbm_verify(h)) != APR_SUCCESS) {
if(rv == APR_ENOENT) { if (APR_STATUS_IS_ENOENT(rv)) {
fprintf(stderr, "The user '%s' could not be found in database\n", h->username); fprintf(stderr, "The user '%s' could not be found in database\n", h->username);
exit(ERR_BADUSER); exit(ERR_BADUSER);
} }