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
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=130719
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);