oops. missed this in my first response:
On Wed, Jan 23, 2002 at 06:28:06PM -0000, [EMAIL PROTECTED] wrote:
>...
> --- repos.c 14 Jan 2002 13:43:24 -0000 1.56
> +++ repos.c 23 Jan 2002 18:28:05 -0000 1.57
> @@ -244,17 +244,43 @@
> *fname_p = NULL;
> }
> else {
> + const char *testpath, *rootpath;
> char *dirpath = ap_make_dirstr_parent(ctx->pool, ctx->pathname);
> apr_size_t dirlen = strlen(dirpath);
> + apr_status_t rv = APR_SUCCESS;
>
> - if (fname_p != NULL)
> - *fname_p = ctx->pathname + dirlen;
> - *dirpath_p = dirpath;
Note that *dirpath_p was _always_ set.
> -
> - /* remove trailing slash from dirpath, unless it's the root dir */
> - /* ### Win32 check */
> - if (dirlen > 1 && dirpath[dirlen - 1] == '/') {
> - dirpath[dirlen - 1] = '\0';
> + testpath = dirpath;
> + if (dirlen > 0) {
> + rv = apr_filepath_root(&rootpath, &testpath, 0, ctx->pool);
> + }
> +
> + /* remove trailing slash from dirpath, unless it's a root path
> + */
> + if ((rv == APR_SUCCESS && testpath && *testpath)
> + || rv == APR_ERELATIVE) {
> + if (dirpath[dirlen - 1] == '/') {
> + dirpath[dirlen - 1] = '\0';
> + }
> + }
> +
> + /* ###: Looks like a response could be appropriate
> + *
> + * APR_SUCCESS here tells us the dir is a root
> + * APR_ERELATIVE told us we had no root (ok)
> + * APR_EINCOMPLETE an incomplete testpath told us
> + * there was no -file- name here!
> + * APR_EBADPATH or other errors tell us this file
> + * path is undecipherable
> + */
> +
> + if (rv == APR_SUCCESS || rv == APR_ERELATIVE) {
> + *dirpath_p = dirpath;
> + if (fname_p != NULL)
> + *fname_p = ctx->pathname + dirlen;
> + }
> + else {
> + if (fname_p != NULL)
> + *fname_p = NULL;
> }
*dirpath_p is not set in the 'else' branch.
Also note that no callers expect those values to be set to NULL. Given that
the paths have been processed by Apache already, it's a good bet they are
always valid.
Cheers,
-g
--
Greg Stein, http://www.lyra.org/