Only initialize f_data and f_ops if nobody else did so already.

This commit is contained in:
Poul-Henning Kamp 2004-06-19 11:41:45 +00:00
parent a769355f9b
commit d7086f313a
2 changed files with 8 additions and 4 deletions

View File

@ -1033,9 +1033,11 @@ kern_open(struct thread *td, char *path, enum uio_seg pathseg, int flags,
return (0);
}
fp->f_vnode = vp;
fp->f_data = vp;
if (fp->f_data == NULL)
fp->f_data = vp;
fp->f_flag = flags & FMASK;
fp->f_ops = &vnops;
if (fp->f_ops == &badfileops)
fp->f_ops = &vnops;
fp->f_seqcount = 1;
fp->f_type = (vp->v_type == VFIFO ? DTYPE_FIFO : DTYPE_VNODE);
FILEDESC_UNLOCK(fdp);

View File

@ -1033,9 +1033,11 @@ kern_open(struct thread *td, char *path, enum uio_seg pathseg, int flags,
return (0);
}
fp->f_vnode = vp;
fp->f_data = vp;
if (fp->f_data == NULL)
fp->f_data = vp;
fp->f_flag = flags & FMASK;
fp->f_ops = &vnops;
if (fp->f_ops == &badfileops)
fp->f_ops = &vnops;
fp->f_seqcount = 1;
fp->f_type = (vp->v_type == VFIFO ? DTYPE_FIFO : DTYPE_VNODE);
FILEDESC_UNLOCK(fdp);