fix path lookup
authorFelix Fietkau <nbd@openwrt.org>
Sun, 13 Jan 2013 10:17:35 +0000 (11:17 +0100)
committerFelix Fietkau <nbd@openwrt.org>
Sun, 13 Jan 2013 10:17:35 +0000 (11:17 +0100)
file.c

diff --git a/file.c b/file.c
index b2e6ade..1238ebd 100644 (file)
--- a/file.c
+++ b/file.c
@@ -179,6 +179,10 @@ uh_path_lookup(struct client *cl, const char *url)
                if (!exists)
                        continue;
 
+               /* test current path */
+               if (stat(path_phys, &p.stat))
+                       continue;
+
                snprintf(path_info, sizeof(path_info), "%s", uh_buf + i);
                break;
        }
@@ -189,10 +193,6 @@ uh_path_lookup(struct client *cl, const char *url)
             path_phys[docroot_len] != '/'))
                return NULL;
 
-       /* test current path */
-       if (stat(path_phys, &p.stat))
-               return NULL;
-
        /* is a regular file */
        if (p.stat.st_mode & S_IFREG) {
                p.root = docroot;