diff options
author | phk <phk@FreeBSD.org> | 2004-12-13 10:07:57 +0000 |
---|---|---|
committer | phk <phk@FreeBSD.org> | 2004-12-13 10:07:57 +0000 |
commit | 7bb3e163ddf24a2dfbd8064416b9af2d8b5ff655 (patch) | |
tree | 72334a8f8f72a873c47a2088824e834e157bbebc /sys/fs/fifofs | |
parent | b67806631484048a929474667cf83d998ce45b12 (diff) | |
download | FreeBSD-src-7bb3e163ddf24a2dfbd8064416b9af2d8b5ff655.zip FreeBSD-src-7bb3e163ddf24a2dfbd8064416b9af2d8b5ff655.tar.gz |
Don't forget to bypass vnodes in corner cases.
Found by: kkenn and ports/shell/zsh
Thanks to: jeffr
Diffstat (limited to 'sys/fs/fifofs')
-rw-r--r-- | sys/fs/fifofs/fifo_vnops.c | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/sys/fs/fifofs/fifo_vnops.c b/sys/fs/fifofs/fifo_vnops.c index 2fcf088..c5125d0 100644 --- a/sys/fs/fifofs/fifo_vnops.c +++ b/sys/fs/fifofs/fifo_vnops.c @@ -276,17 +276,15 @@ fail1: * a reader. That (and not still having one) * is the condition that we must wait for. */ - return (0); + mtx_lock(&fifo_mtx); } } mtx_unlock(&fifo_mtx); - if (ap->a_fdidx >= 0) { - fp = ap->a_td->td_proc->p_fd->fd_ofiles[ap->a_fdidx]; - if (fp->f_ops == &badfileops) { - fp->f_ops = &fifo_ops_f; - fp->f_data = fip; - } - } + KASSERT(ap->a_fdidx >= 0, ("can't fifo/vnode bypass %d", ap->a_fdidx)); + fp = ap->a_td->td_proc->p_fd->fd_ofiles[ap->a_fdidx]; + KASSERT(fp->f_ops == &badfileops, ("not badfileops in fifo_open")); + fp->f_ops = &fifo_ops_f; + fp->f_data = fip; return (0); } |