From 265bcb9e6fd6611eda6bba3aed13da83e584e058 Mon Sep 17 00:00:00 2001 From: "John Hodge (sonata)" Date: Sun, 20 Jan 2013 14:26:34 +0800 Subject: [PATCH] Kernel/vfs - Better handling of -1 in handle list --- KernelLand/Kernel/vfs/handle.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/KernelLand/Kernel/vfs/handle.c b/KernelLand/Kernel/vfs/handle.c index 1f3e3790..cb4fae12 100644 --- a/KernelLand/Kernel/vfs/handle.c +++ b/KernelLand/Kernel/vfs/handle.c @@ -196,7 +196,14 @@ void *VFS_SaveHandles(int NumFDs, int *FDs) tVFS_Handle *h; if( FDs == NULL ) h = &gaUserHandles[i]; - else { + else if( FDs[i] == -1 ) + { + Log_Warning("VFS", "VFS_SaveHandles - Slot %i error FD (-1), ignorning", i); + memset(&ret[i], 0, sizeof(tVFS_Handle)); + continue ; + } + else + { h = VFS_GetHandle(FDs[i] & (VFS_KERNEL_FLAG - 1)); if(!h) { Log_Warning("VFS", "VFS_SaveHandles - Invalid FD %i", -- 2.20.1