fielding 97/09/14 03:53:25
Modified: src/main http_request.c Log: Cleanup an ifdef section so that it is readable by mere mortals (and indent, which puked rather badly on the interleaved elses). Revision Changes Path 1.84 +21 -14 apachen/src/main/http_request.c Index: http_request.c =================================================================== RCS file: /export/home/cvs/apachen/src/main/http_request.c,v retrieving revision 1.83 retrieving revision 1.84 diff -u -r1.83 -r1.84 --- http_request.c 1997/09/11 19:07:51 1.83 +++ http_request.c 1997/09/14 10:53:24 1.84 @@ -199,8 +199,27 @@ } #if defined(ENOENT) && defined(ENOTDIR) else if (errno == ENOENT || errno == ENOTDIR) { + last_cp = cp; + + while (--cp > path && *cp != '/') + continue; + + while (cp > path && cp[-1] == '/') + --cp; + } + else { +#if defined(EACCES) + if (errno != EACCES) +#endif + aplog_error(APLOG_MARK, APLOG_ERR, r->server, + "access to %s failed for %s", r->uri, + get_remote_host(r->connection, r->per_dir_config, + REMOTE_NAME)); + return HTTP_FORBIDDEN; + } #else -#error ENOENT || ENOTDIR not defined -- check the comment below this line in the source for details +#error ENOENT || 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 * include files, Apache does not know how to check to see why @@ -209,7 +228,7 @@ * that it is possible for someone to get a directory * listing of a directory even though there is an index * (eg. index.html) file in it. If you do not have a - * problem with this, delete the above #error line and + * problem with this, delete the above #error lines and * start the compile again. If you need to do this, please * submit a bug report from http://www.apache.org/bug_report.html * letting us know that you needed to do this. Please be @@ -217,7 +236,6 @@ */ else { -#endif last_cp = cp; while (--cp > path && *cp != '/') @@ -226,17 +244,6 @@ while (cp > path && cp[-1] == '/') --cp; } -#if defined(ENOENT) && defined(ENOTDIR) - else { -#if defined(EACCES) - if (errno != EACCES) -#endif - aplog_error(APLOG_MARK, APLOG_ERR, r->server, - "access to %s failed for %s", r->uri, - get_remote_host(r->connection, r->per_dir_config, REMOTE_NAME)); - - return HTTP_FORBIDDEN; - } #endif /* ENOENT && ENOTDIR */ } return OK;