X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;f=Kernel%2Fvfs%2Fdir.c;h=b7af755b97ca6f76b98c410e3a1e028a2b09971e;hb=b62bb4c2b6da7c3391f5346d9e349adfea2d78a2;hp=b4001dd1a3f51dde96147b22b5df0a0d9011a0e6;hpb=72fcc8d0873e91f713be3d23af32a4e83f40cdf5;p=tpg%2Facess2.git diff --git a/Kernel/vfs/dir.c b/Kernel/vfs/dir.c index b4001dd1..b7af755b 100644 --- a/Kernel/vfs/dir.c +++ b/Kernel/vfs/dir.c @@ -141,13 +141,25 @@ int VFS_ReadDir(int FD, char *Dest) tVFS_Handle *h = VFS_GetHandle(FD); char *tmp; - if(h) return -1; + ENTER("ph pDest", h, Dest); - if(h->Node->ReadDir == NULL) return 0; + if(!h || h->Node->ReadDir == NULL) { + LEAVE('i', 0); + return 0; + } + + if(h->Position >= h->Node->Size) { + LEAVE('i', 0); + return 0; + } tmp = h->Node->ReadDir(h->Node, h->Position); + LOG("tmp = '%s'", tmp); - if(!tmp) return 0; + if(!tmp) { + LEAVE('i', 0); + return 0; + } h->Position ++; @@ -155,5 +167,6 @@ int VFS_ReadDir(int FD, char *Dest) if(IsHeap(tmp)) free(tmp); + LEAVE('i', 1); return 1; }