From: William A. Rowe Jr Date: Mon, 23 Oct 2000 16:58:21 +0000 (+0000) Subject: A more thorough example is appropriate. Also simplify the behavior and X-Git-Tag: APACHE_2_0_ALPHA_8~269 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=6abb1eaf131223c656039b08893735abeec61458;p=apache A more thorough example is appropriate. Also simplify the behavior and always return root (/) if n < 1, which is no worse than returning elems if n > elems. PR: Obtained from: Submitted by: Reviewed by: git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@86717 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/server/util.c b/server/util.c index a3aab61b2d..3eccf5ed9d 100644 --- a/server/util.c +++ b/server/util.c @@ -564,20 +564,25 @@ AP_DECLARE(void) ap_no2slash(char *name) * *** See also directory_walk in src/main/http_request.c * examples: + * /a/b, 0 ==> / (true for all platforms) * /a/b, 1 ==> / * /a/b, 2 ==> /a/ * /a/b, 3 ==> /a/b/ * /a/b, 4 ==> /a/b/ + * + * c:/a/b 0 ==> / + * c:/a/b 1 ==> c:/ + * c:/a/b 2 ==> c:/a/ + * c:/a/b 3 ==> c:/a/b + * c:/a/b 4 ==> c:/a/b */ AP_DECLARE(char *) ap_make_dirstr_prefix(char *d, const char *s, int n) { -#if defined(HAVE_DRIVE_LETTERS) || defined(NETWARE) - if (!n) { + if (n < 1) { *d = '/'; *++d = '\0'; return (d); } -#endif /* def HAVE_DRIVE_LETTERS || NETWARE */ for (;;) { if (*s == '\0' || (*s == '/' && (--n) == 0)) {