make sure we had the filedesc lock when calling fdinit when RFCFDG is set

on call to rfork.

Submitted by:	Brian Buchanan
Semi-Reviewed by: rwatson
This commit is contained in:
John-Mark Gurney 2004-03-10 00:27:36 +00:00
parent c2026e4db2
commit 0235bf0261

View File

@ -232,7 +232,9 @@ fork1(td, flags, pages, procp)
*/
if (flags & RFCFDG) {
struct filedesc *fdtmp;
FILEDESC_LOCK(td->td_proc->p_fd);
fdtmp = fdinit(td->td_proc->p_fd);
FILEDESC_UNLOCK(td->td_proc->p_fd);
fdfree(td);
p1->p_fd = fdtmp;
}
@ -428,7 +430,9 @@ fork1(td, flags, pages, procp)
* Copy filedesc.
*/
if (flags & RFCFDG) {
FILEDESC_LOCK(td->td_proc->p_fd);
fd = fdinit(td->td_proc->p_fd);
FILEDESC_UNLOCK(td->td_proc->p_fd);
fdtol = NULL;
} else if (flags & RFFDG) {
FILEDESC_LOCK(p1->p_fd);