X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;f=KernelLand%2FKernel%2Fvfs%2Fdir.c;fp=KernelLand%2FKernel%2Fvfs%2Fdir.c;h=fab9d563c37e49279eaa63b42db32edd6b1445ed;hb=4ebe00546574e97c5316881881f7f2562deea74b;hp=65218af09bd2fcf294c0f3cbf8ce346859b300dc;hpb=bf62604f78c2d8bc88cac3664e15ed02c6e6d581;p=tpg%2Facess2.git diff --git a/KernelLand/Kernel/vfs/dir.c b/KernelLand/Kernel/vfs/dir.c index 65218af0..fab9d563 100644 --- a/KernelLand/Kernel/vfs/dir.c +++ b/KernelLand/Kernel/vfs/dir.c @@ -41,7 +41,7 @@ int VFS_MkNod(const char *Path, Uint Flags) int pos = 0, oldpos = 0; int next = 0; tVFS_Node *parent; - int ret; + tVFS_Node *ret; ENTER("sPath xFlags", Path, Flags); @@ -92,6 +92,7 @@ int VFS_MkNod(const char *Path, Uint Flags) // Create node ret = parent->Type->MkNod(parent, name, Flags); + _CloseNode(ret); // Free allocated string free(absPath); @@ -101,8 +102,8 @@ int VFS_MkNod(const char *Path, Uint Flags) _CloseNode(parent); // Return whatever the driver said - LEAVE('i', ret); - return ret; + LEAVE('i', ret==NULL); + return ret==NULL; } /** @@ -154,7 +155,7 @@ int VFS_Symlink(const char *Name, const char *Link) int VFS_ReadDir(int FD, char *Dest) { tVFS_Handle *h = VFS_GetHandle(FD); - char *tmp; + int rv; //ENTER("ph pDest", h, Dest); @@ -169,23 +170,18 @@ int VFS_ReadDir(int FD, char *Dest) } do { - tmp = h->Node->Type->ReadDir(h->Node, h->Position); - if((Uint)tmp < (Uint)VFS_MAXSKIP) - h->Position += (Uint)tmp; + rv = h->Node->Type->ReadDir(h->Node, h->Position, Dest); + if(rv > 0) + h->Position += rv; else h->Position ++; - } while(tmp != NULL && (Uint)tmp < (Uint)VFS_MAXSKIP); + } while(rv > 0); - //LOG("tmp = '%s'", tmp); - - if(!tmp) { + if(rv < 0) { //LEAVE('i', 0); return 0; } - strcpy(Dest, tmp); - free(tmp); - //LEAVE('i', 1); return 1; }