X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;f=Kernel%2Fvfs%2Fopen.c;h=3a687037442a37943c82634e4b7ff9da85cea6c5;hb=47e9dfd89189fc6b150bd6b20229cb047c7e0858;hp=7382a0c8705fef38ced66a70c3e2286839b1bb53;hpb=900f2d7853a5dd5d0f1a27c2374ecda434d6d866;p=tpg%2Facess2.git diff --git a/Kernel/vfs/open.c b/Kernel/vfs/open.c index 7382a0c8..3a687037 100644 --- a/Kernel/vfs/open.c +++ b/Kernel/vfs/open.c @@ -39,7 +39,6 @@ char *VFS_GetAbsPath(char *Path) char *cwd = CFGPTR(CFG_VFS_CWD); int cwdLen; - ENTER("sPath", Path); // Memory File @@ -54,6 +53,7 @@ char *VFS_GetAbsPath(char *Path) return ret; } + // - Fetch ChRoot if( chroot == NULL ) { chroot = ""; chrootLen = 0; @@ -63,13 +63,12 @@ char *VFS_GetAbsPath(char *Path) // Check if the path is already absolute if(Path[0] == '/') { - ret = malloc(chrootLen + pathLen + 1); + ret = malloc(pathLen + 1); if(!ret) { Warning("VFS_GetAbsPath - malloc() returned NULL"); return NULL; } - strcpy(ret, chroot); - strcpy(ret+chrootLen, Path); + strcpy(ret, Path); } else { if(cwd == NULL) { cwd = "/"; @@ -153,6 +152,14 @@ char *VFS_GetAbsPath(char *Path) else ret[iPos2] = 0; + + // Prepend the chroot + tmpStr = malloc(chrootLen + strlen(ret) + 1); + strcpy( tmpStr, chroot ); + strcpy( tmpStr+chrootLen, ret ); + free(ret); + ret = tmpStr; + LEAVE('s', ret); //Log("VFS_GetAbsPath: RETURN '%s'", ret); return ret; @@ -659,3 +666,7 @@ tVFS_Handle *VFS_GetHandle(int FD) if(h->Node == NULL) return NULL; return h; } + +// === EXPORTS === +EXPORT(VFS_Open); +EXPORT(VFS_Close);