Now that fdgrowtable() doesn't drop the filedesc lock we don't need to

check if descriptor changed from under us. Replace the check with an
assert.

Discussed with:	kib
Tested by:	pho
MFC after:	1 month
This commit is contained in:
pjd 2012-06-11 19:48:55 +00:00
parent 6b0d4730f1
commit 2042e99ed8

View File

@ -871,19 +871,7 @@ do_dup(struct thread *td, int flags, int old, int new,
}
}
/*
* If the old file changed out from under us then treat it as a
* bad file descriptor. Userland should do its own locking to
* avoid this case.
*/
if (fdp->fd_ofiles[old] != fp) {
/* we've allocated a descriptor which we won't use */
if (fdp->fd_ofiles[new] == NULL)
fdunused(fdp, new);
FILEDESC_XUNLOCK(fdp);
fdrop(fp, td);
return (EBADF);
}
KASSERT(fp == fdp->fd_ofiles[old], ("old fd has been modified"));
KASSERT(old != new, ("new fd is same as old"));
/*