X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;f=AcessNative%2Facesskernel_src%2Fnativefs.c;h=0e791b8fe49167cf6154d4ceb8cb5839758f2bef;hb=4ebe00546574e97c5316881881f7f2562deea74b;hp=7c20b69e0d55e10cf8b4f37aa8b4e610e0b07f5e;hpb=bf62604f78c2d8bc88cac3664e15ed02c6e6d581;p=tpg%2Facess2.git diff --git a/AcessNative/acesskernel_src/nativefs.c b/AcessNative/acesskernel_src/nativefs.c index 7c20b69e..0e791b8f 100644 --- a/AcessNative/acesskernel_src/nativefs.c +++ b/AcessNative/acesskernel_src/nativefs.c @@ -31,7 +31,7 @@ typedef struct tVFS_Node *NativeFS_Mount(const char *Device, const char **Arguments); void NativeFS_Unmount(tVFS_Node *Node); tVFS_Node *NativeFS_FindDir(tVFS_Node *Node, const char *Name); -char *NativeFS_ReadDir(tVFS_Node *Node, int Position); + int NativeFS_ReadDir(tVFS_Node *Node, int Position, char Dest[FILENAME_MAX]); size_t NativeFS_Read(tVFS_Node *Node, _acess_off_t Offset, size_t Length, void *Buffer); size_t NativeFS_Write(tVFS_Node *Node, _acess_off_t Offset, size_t Length, const void *Buffer); void NativeFS_Close(tVFS_Node *Node); @@ -168,11 +168,10 @@ tVFS_Node *NativeFS_FindDir(tVFS_Node *Node, const char *Name) return Inode_CacheNode(info->InodeHandle, &baseRet); } -char *NativeFS_ReadDir(tVFS_Node *Node, int Position) +int NativeFS_ReadDir(tVFS_Node *Node, int Position, char Dest[FILENAME_MAX]) { struct dirent *ent; DIR *dp = (void*)(tVAddr)Node->Inode; - char *ret; ENTER("pNode iPosition", Node, Position); @@ -184,16 +183,16 @@ char *NativeFS_ReadDir(tVFS_Node *Node, int Position) } while(Position-- && ent); if( !ent ) { - LEAVE('n'); - return NULL; + LEAVE('i', -ENOENT); + return -ENOENT; } - ret = strdup(ent->d_name); + strncpy(Dest, ent->d_name, FILENAME_MAX); // TODO: Unlock node - LEAVE('s', ret); - return ret; + LEAVE('i', 0); + return 0; } size_t NativeFS_Read(tVFS_Node *Node, _acess_off_t Offset, size_t Length, void *Buffer)