X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;f=AcessNative%2Facesskernel_src%2Fvfs_handle.c;h=6c3992f8cb39e2ff898a1bc17b011cfae1d64a2b;hb=624e1386acc66a0a5fa51fa9c4aa1f616eddaaa4;hp=eb0bfc58509790e1622d9f24ed65f223fd9daa3f;hpb=b204bbefadbc511b2d9a5a17a099e75b46ebec6d;p=tpg%2Facess2.git diff --git a/AcessNative/acesskernel_src/vfs_handle.c b/AcessNative/acesskernel_src/vfs_handle.c index eb0bfc58..6c3992f8 100644 --- a/AcessNative/acesskernel_src/vfs_handle.c +++ b/AcessNative/acesskernel_src/vfs_handle.c @@ -155,11 +155,10 @@ tVFS_Handle *VFS_GetHandle(int FD) } else { - tUserHandles *ent; int pid = Threads_GetPID(); int maxhandles = *Threads_GetMaxFD(); - ent = VFS_int_GetUserHandles(pid, 0); + tUserHandles *ent = VFS_int_GetUserHandles(pid, 0); if(!ent) { Log_Error("VFS", "Client %i does not have a handle list (>)", pid); return NULL; @@ -248,3 +247,18 @@ int VFS_AllocHandle(int bIsUser, tVFS_Node *Node, int Mode) return -1; } + +void VFS_ClearHandles(int PID) +{ + // Find the PID's handle list + tUserHandles *ent = VFS_int_GetUserHandles(PID, 0); + if( !ent ) return; + // Get a handle + int maxhandles = *Threads_GetMaxFD(); + for( int i = 0; i < maxhandles; i ++ ) + { + if(ent->Handles[i].Node) continue; + _CloseNode(ent->Handles[i].Node); + ent->Handles[i].Node = NULL; + } +}