diff options
author | scottl <scottl@FreeBSD.org> | 2003-02-24 05:46:55 +0000 |
---|---|---|
committer | scottl <scottl@FreeBSD.org> | 2003-02-24 05:46:55 +0000 |
commit | d3806508a829dfeb0d5fac145c9cfe336522d32a (patch) | |
tree | 04338b900c35ac57ccc0bcae41990cbcd45a4d96 /sys | |
parent | 558a6485f67420ace8c5a7e756e1fca17809c289 (diff) | |
download | FreeBSD-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')
-rw-r--r-- | sys/kern/kern_descrip.c | 10 |
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) |