]> granicus.if.org Git - apache/commitdiff
Get mod_cern_meta to work on Windows. The problem was in the
authorBill Stoddard <stoddard@apache.org>
Mon, 7 May 2001 14:03:59 +0000 (14:03 +0000)
committerBill Stoddard <stoddard@apache.org>
Mon, 7 May 2001 14:03:59 +0000 (14:03 +0000)
"skip leading slash" logic, which is inheriently broken on Windows
because full Windows filenames begin with a drive letter or UNC
path.

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@89046 13f79535-47bb-0310-9956-ffa450edef68

modules/metadata/mod_cern_meta.c

index 44a1ebae3e903f61d1f7c254c157eb364a11cb32..4bb69ec3bcbb5faee65a6525ac3e696259586845 100644 (file)
@@ -309,6 +309,7 @@ static int scan_meta_file(request_rec *r, apr_file_t *f)
 static int add_cern_meta_data(request_rec *r)
 {
     char *metafilename;
+    char *leading_slash;
     char *last_slash;
     char *real_file;
     char *scrap_book;
@@ -337,10 +338,10 @@ static int add_cern_meta_data(request_rec *r)
 
     /* what directory is this file in? */
     scrap_book = apr_pstrdup(r->pool, r->filename);
-    /* skip leading slash, recovered in later processing */
-    scrap_book++;
+
+    leading_slash = strchr(scrap_book, '/');
     last_slash = strrchr(scrap_book, '/');
-    if (last_slash != NULL) {
+    if ((last_slash != NULL) && (last_slash != leading_slash)) {
        /* skip over last slash */
        real_file = last_slash;
        real_file++;
@@ -354,7 +355,7 @@ static int add_cern_meta_data(request_rec *r)
        return DECLINED;
     };
 
-    metafilename = apr_pstrcat(r->pool, "/", scrap_book, "/",
+    metafilename = apr_pstrcat(r->pool, scrap_book, "/",
                           dconf->metadir ? dconf->metadir : DEFAULT_METADIR,
                           "/", real_file,
                 dconf->metasuffix ? dconf->metasuffix : DEFAULT_METASUFFIX,