Diff
Not logged in

Differences From:

File src/file.c part of check-in [e146d800ac] - Add the "mv" and "rename" commands (aliases for the same thing). by drh on 2008-11-09 19:22:06. [view]

To:

File src/file.c part of check-in [d31c0f9c29] - Fix to the pathname simplifer logic. by drh on 2008-11-21 22:16:08. [view]

@@ -208,9 +208,9 @@
 ** 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){
@@ -224,9 +224,10 @@
         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];