summaryrefslogtreecommitdiffstats
path: root/sys/kern
diff options
context:
space:
mode:
authorscottl <scottl@FreeBSD.org>2003-02-24 05:46:55 +0000
committerscottl <scottl@FreeBSD.org>2003-02-24 05:46:55 +0000
commitd3806508a829dfeb0d5fac145c9cfe336522d32a (patch)
tree04338b900c35ac57ccc0bcae41990cbcd45a4d96 /sys/kern
parent558a6485f67420ace8c5a7e756e1fca17809c289 (diff)
downloadFreeBSD-src-d3806508a829dfeb0d5fac145c9cfe336522d32a.zip
FreeBSD-src-d3806508a829dfeb0d5fac145c9cfe336522d32a.tar.gz
Don't NULL out p_fd until after closefd() has been called. This isn't
totally correct, but it has caused breakage for too long. I welcome someone with more fd fu to fix it correctly.
Diffstat (limited to 'sys/kern')
-rw-r--r--sys/kern/kern_descrip.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/sys/kern/kern_descrip.c b/sys/kern/kern_descrip.c
index 62d7348..25f9f46 100644
--- a/sys/kern/kern_descrip.c
+++ b/sys/kern/kern_descrip.c
@@ -1411,10 +1411,6 @@ fdfree(td)
if (fdp == NULL)
return;
- mtx_lock(&fdesc_mtx);
- td->td_proc->p_fd = NULL;
- mtx_unlock(&fdesc_mtx);
-
FILEDESC_LOCK(fdp);
if (--fdp->fd_refcnt > 0) {
FILEDESC_UNLOCK(fdp);
@@ -1431,6 +1427,12 @@ fdfree(td)
if (*fpp)
(void) closef(*fpp, td);
}
+
+ /* XXX This should happen earlier. */
+ mtx_lock(&fdesc_mtx);
+ td->td_proc->p_fd = NULL;
+ mtx_unlock(&fdesc_mtx);
+
if (fdp->fd_nfiles > NDFILE)
FREE(fdp->fd_ofiles, M_FILEDESC);
if (fdp->fd_cdir)
OpenPOWER on IntegriCloud