diff options
-rw-r--r-- | sys/kern/kern_descrip.c | 3 | ||||
-rw-r--r-- | sys/kern/kern_exec.c | 2 | ||||
-rw-r--r-- | sys/kern/kern_fork.c | 8 |
3 files changed, 5 insertions, 8 deletions
diff --git a/sys/kern/kern_descrip.c b/sys/kern/kern_descrip.c index 8f5ea75..8f8f636 100644 --- a/sys/kern/kern_descrip.c +++ b/sys/kern/kern_descrip.c @@ -1494,8 +1494,6 @@ fdcopy(fdp) if (fdp == NULL) return (NULL); - FILEDESC_LOCK_ASSERT(fdp, MA_OWNED); - FILEDESC_UNLOCK(fdp); newfdp = fdinit(fdp); FILEDESC_LOCK(fdp); while (fdp->fd_lastfile >= newfdp->fd_nfiles) { @@ -1529,6 +1527,7 @@ fdcopy(fdp) if (newfdp->fd_freefile == -1) newfdp->fd_freefile = i; newfdp->fd_cmask = fdp->fd_cmask; + FILEDESC_UNLOCK(fdp); return (newfdp); } diff --git a/sys/kern/kern_exec.c b/sys/kern/kern_exec.c index 06cbc68..c6d3e5c 100644 --- a/sys/kern/kern_exec.c +++ b/sys/kern/kern_exec.c @@ -469,8 +469,8 @@ interpret: if (p->p_fd->fd_refcnt > 1) { struct filedesc *tmp; - tmp = fdcopy(td->td_proc->p_fd); FILEDESC_UNLOCK(p->p_fd); + tmp = fdcopy(p->p_fd); fdfree(td); p->p_fd = tmp; } else diff --git a/sys/kern/kern_fork.c b/sys/kern/kern_fork.c index f90ff32..c6e2f12 100644 --- a/sys/kern/kern_fork.c +++ b/sys/kern/kern_fork.c @@ -238,8 +238,8 @@ fork1(td, flags, pages, procp) if (p1->p_fd->fd_refcnt > 1) { struct filedesc *newfd; - newfd = fdcopy(td->td_proc->p_fd); FILEDESC_UNLOCK(p1->p_fd); + newfd = fdcopy(p1->p_fd); fdfree(td); p1->p_fd = newfd; } else @@ -421,12 +421,10 @@ again: * Copy filedesc. */ if (flags & RFCFDG) { - fd = fdinit(td->td_proc->p_fd); + fd = fdinit(p1->p_fd); fdtol = NULL; } else if (flags & RFFDG) { - FILEDESC_LOCK(p1->p_fd); - fd = fdcopy(td->td_proc->p_fd); - FILEDESC_UNLOCK(p1->p_fd); + fd = fdcopy(p1->p_fd); fdtol = NULL; } else { fd = fdshare(p1->p_fd); |