about summary refs log tree commit diff
path: root/src/tipideed/tipideed.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/tipideed/tipideed.c')
-rw-r--r--src/tipideed/tipideed.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/tipideed/tipideed.c b/src/tipideed/tipideed.c
index a8dd944..9ed9899 100644
--- a/src/tipideed/tipideed.c
+++ b/src/tipideed/tipideed.c
@@ -252,8 +252,8 @@ static inline int serve (tipidee_rql *rql, char const *docroot, char *uribuf, ti
     size_t pos = docrootlen + pathlen - 1 ;
     for (;;)
     {
-      while (fn[pos] != '/') pos-- ;
-      if (pos <= docrootlen) { respond_404(rql, docroot) ; return 0 ; }
+      while (pos && fn[pos] != '/') pos-- ;
+      if (!pos) { respond_404(rql, docroot) ; return 0 ; }
       fn[pos] = 0 ;
       if (stat(fn, &st) == 0) break ;
       switch (errno)