Update fd_freefile when kqueue descriptors are not copied from

parent to child. From Wolfgang Solfrank in PR kern/41651.
Approved by Andrew Doran.
This commit is contained in:
martin 2009-06-30 20:32:49 +00:00
parent 0ff3383f59
commit 53822d1e78

View File

@ -1,4 +1,4 @@
/* $NetBSD: kern_descrip.c,v 1.197 2009/06/08 00:19:56 yamt Exp $ */ /* $NetBSD: kern_descrip.c,v 1.198 2009/06/30 20:32:49 martin Exp $ */
/*- /*-
* Copyright (c) 2008, 2009 The NetBSD Foundation, Inc. * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
@ -70,7 +70,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: kern_descrip.c,v 1.197 2009/06/08 00:19:56 yamt Exp $"); __KERNEL_RCSID(0, "$NetBSD: kern_descrip.c,v 1.198 2009/06/30 20:32:49 martin Exp $");
#include <sys/param.h> #include <sys/param.h>
#include <sys/systm.h> #include <sys/systm.h>
@ -1423,6 +1423,8 @@ fd_copy(void)
} }
if (__predict_false(fp->f_type == DTYPE_KQUEUE)) { if (__predict_false(fp->f_type == DTYPE_KQUEUE)) {
/* kqueue descriptors cannot be copied. */ /* kqueue descriptors cannot be copied. */
if (i < newfdp->fd_freefile)
newfdp->fd_freefile = i;
continue; continue;
} }
/* It's active: add a reference to the file. */ /* It's active: add a reference to the file. */