SCCS-vsn: sys/kern/kern_descrip.c 8.6
*
* %sccs.include.redist.c%
*
*
* %sccs.include.redist.c%
*
- * @(#)kern_descrip.c 8.5 (Berkeley) %G%
+ * @(#)kern_descrip.c 8.6 (Berkeley) %G%
*/
#include <sys/param.h>
*/
#include <sys/param.h>
*/
nfiles++;
MALLOC(fp, struct file *, sizeof(struct file), M_FILE, M_WAITOK);
*/
nfiles++;
MALLOC(fp, struct file *, sizeof(struct file), M_FILE, M_WAITOK);
+ bzero(fp, sizeof(struct file));
if (fq = p->p_fd->fd_ofiles[0])
fpp = &fq->f_filef;
else
if (fq = p->p_fd->fd_ofiles[0])
fpp = &fq->f_filef;
else
fp->f_fileb = fpp;
*fpp = fp;
fp->f_count = 1;
fp->f_fileb = fpp;
*fpp = fp;
fp->f_count = 1;
- fp->f_msgcount = 0;
- fp->f_offset = 0;
fp->f_cred = p->p_ucred;
crhold(fp->f_cred);
if (resultfp)
fp->f_cred = p->p_ucred;
crhold(fp->f_cred);
if (resultfp)
vp = (struct vnode *)fp->f_data;
(void) VOP_ADVLOCK(vp, (caddr_t)fp, F_UNLCK, &lf, F_FLOCK);
}
vp = (struct vnode *)fp->f_data;
(void) VOP_ADVLOCK(vp, (caddr_t)fp, F_UNLCK, &lf, F_FLOCK);
}
- error = (*fp->f_ops->fo_close)(fp, p);
+ if (fp->f_ops)
+ error = (*fp->f_ops->fo_close)(fp, p);
+ else
+ error = 0;
ffree(fp);
return (error);
}
ffree(fp);
return (error);
}