diff options
author | pjd <pjd@FreeBSD.org> | 2012-06-11 19:48:55 +0000 |
---|---|---|
committer | pjd <pjd@FreeBSD.org> | 2012-06-11 19:48:55 +0000 |
commit | 2042e99ed8ccdef6450180d8e17ea548b55394d3 (patch) | |
tree | 1493d6a2fd1ec1e1d9fe61f417b6107751568d86 /sys/kern/kern_descrip.c | |
parent | 6b0d4730f1699cbab3fd04bcf6c881521101bf6b (diff) | |
download | FreeBSD-src-2042e99ed8ccdef6450180d8e17ea548b55394d3.zip FreeBSD-src-2042e99ed8ccdef6450180d8e17ea548b55394d3.tar.gz |
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
Diffstat (limited to 'sys/kern/kern_descrip.c')
-rw-r--r-- | sys/kern/kern_descrip.c | 14 |
1 files changed, 1 insertions, 13 deletions
diff --git a/sys/kern/kern_descrip.c b/sys/kern/kern_descrip.c index 6444e5d..1fbf3e9 100644 --- a/sys/kern/kern_descrip.c +++ b/sys/kern/kern_descrip.c @@ -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")); /* |