Check-in [d31c0f9c29]
Not logged in
Overview

SHA1 Hash:d31c0f9c29b27aa9deaae9adde86a94cebc2e43d
Date: 2008-11-21 22:16:08
User: drh
Comment:Fix to the pathname simplifer logic.
Timelines: ancestors | descendants | both | trunk
Other Links: files | ZIP archive | manifest

Tags And Properties
Changes
[hide diffs]

Modified src/file.c from [3bd9bc50a5] to [5e3422939d].

@@ -207,11 +207,11 @@
 /*
 ** Simplify a filename by
 **
 **  * removing any trailing and duplicate /
 **  * removing /./
-**  * removing /A/./
+**  * removing /A/../
 **
 ** Changes are made in-place.  Return the new name length.
 */
 int file_simplify_name(char *z, int n){
   int i, j;
@@ -223,11 +223,12 @@
         i += 1;
         continue;
       }
       if( z[i+1]=='.' && i+3<n && z[i+2]=='.' && z[i+3]=='/' ){
         while( j>0 && z[j-1]!='/' ){ j--; }
-        i += 3;
+        if( j>0 ){ j--; }
+        i += 2;
         continue;
       }
     }
     z[j++] = z[i];
   }