Usermode/ld-acess - Added two more ARM relocation types
[tpg/acess2.git] / Kernel / vfs / open.c
index c4c9bbf..a886c45 100644 (file)
@@ -55,12 +55,9 @@ char *VFS_GetAbsPath(const char *Path)
        }
        
        // - Fetch ChRoot
-       if( chroot == NULL ) {
+       if( chroot == NULL )
                chroot = "";
-               chrootLen = 0;
-       } else {
-               chrootLen = strlen(chroot);
-       }
+       chrootLen = strlen(chroot);
        
        // Check if the path is already absolute
        if(Path[0] == '/') {
@@ -155,7 +152,8 @@ char *VFS_GetAbsPath(const char *Path)
                ret[iPos2] = 0;
 
        // Prepend the chroot
-       memcpy( ret, chroot, chrootLen );
+       if(chrootLen)
+               memcpy( ret, chroot, chrootLen );
        
        LEAVE('s', ret);
 //     Log_Debug("VFS", "VFS_GetAbsPath: RETURN '%s'", ret);
@@ -199,6 +197,7 @@ restart_parse:
                        *TruePath = malloc( gVFS_RootMount->MountPointLen+1 );
                        strcpy(*TruePath, gVFS_RootMount->MountPoint);
                }
+               if(MountPoint)  *MountPoint = gVFS_RootMount;
                LEAVE('p', gVFS_RootMount->RootNode);
                return gVFS_RootMount->RootNode;
        }
@@ -347,6 +346,7 @@ restart_parse:
                                }
                                curNode->Read( curNode, 0, curNode->Size, path_buffer );
                                path_buffer[ curNode->Size ] = '\0';
+                               LOG("path_buffer = '%s'", path_buffer);
                                strcat(path_buffer, Path + ofs+nextSlash);
                                
                                Path = path_buffer;
@@ -355,6 +355,7 @@ restart_parse:
                        }
 
                        // EVIL: Goto :)
+                       LOG("Symlink -> '%s', restart", Path);
                        goto restart_parse;
                }
                
@@ -453,7 +454,7 @@ int VFS_int_CreateHandle( tVFS_Node *Node, tVFS_Mount *Mount, int Mode )
 {
         int    i;
        
-       ENTER("pNode pMount iMode", Node, Mount, Mode);
+       ENTER("pNode pMount xMode", Node, Mount, Mode);
 
        i = 0;
        i |= (Mode & VFS_OPENFLAG_EXEC) ? VFS_PERM_EXECUTE : 0;
@@ -536,7 +537,7 @@ int VFS_Open(const char *Path, Uint Mode)
                        LEAVE_RET('i', -1);
                }
        }
-       
+
        LEAVE_RET('x', VFS_int_CreateHandle(node, mnt, Mode));
 }
 
@@ -650,14 +651,14 @@ int VFS_ChDir(const char *Dest)
        // Create Absolute
        buf = VFS_GetAbsPath(Dest);
        if(buf == NULL) {
-               Log("VFS_ChDir: Path expansion failed");
+               Log_Notice("VFS", "VFS_ChDir: Path expansion failed");
                return -1;
        }
        
        // Check if path exists
        fd = VFS_Open(buf, VFS_OPENFLAG_EXEC);
        if(fd == -1) {
-               Log("VFS_ChDir: Path is invalid");
+               Log_Notice("VFS", "VFS_ChDir: Path is invalid");
                return -1;
        }
        

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