Included leading / in path parsing
[tpg/acess2.git] / Kernel / vfs / open.c
index 2eccac2..1d86910 100644 (file)
@@ -69,7 +69,7 @@ char *VFS_GetAbsPath(char *Path)
        }
        
        // Remove . and ..
-       read = write = 1;       // Cwd has already been parsed
+       read = write = 0;       // Cwd has already been parsed
        for(; read < baseLen+pathLen; read = pos+1)
        {
                pos = strpos( &ret[read], '/' );
@@ -89,9 +89,9 @@ char *VFS_GetAbsPath(char *Path)
                        if(strncmp(&ret[read], "..", pos-read) == 0)
                        {
                                // If there is no higher, silently ignore
-                               if(!slashNum)   continue;
+                               if(slashNum < 2)        continue;
                                // Reverse write pointer
-                               write = slashOffsets[ --slashNum ];
+                               write = slashOffsets[ --slashNum - 1 ];
                                continue;
                        }
                }

UCC git Repository :: git.ucc.asn.au