diff options
author | julian <julian@FreeBSD.org> | 2001-09-12 20:26:57 +0000 |
---|---|---|
committer | julian <julian@FreeBSD.org> | 2001-09-12 20:26:57 +0000 |
commit | 1bda6a607a245d198d36f589a6d8d42d9ea45b86 (patch) | |
tree | 3b9a389df263293ac7beeb625cda852c1e2841e2 /sys/kern/kern_descrip.c | |
parent | 12c7e49b74c6f21bec4a43fc126ad168736fadbf (diff) | |
download | FreeBSD-src-1bda6a607a245d198d36f589a6d8d42d9ea45b86.zip FreeBSD-src-1bda6a607a245d198d36f589a6d8d42d9ea45b86.tar.gz |
If an incoming struct proc could have been NULL before, tehn don't
automatically change the code to add
struct proc *p = td->td_proc;
because now 'td' is probably capable of being NULL too.
I expect to see more of this kind of error during the 'weeding'
process. It's too easy to make. (junior hacker project.. look for these :-)
Submitted by: mark Peek <mp@freebsd.org>
Diffstat (limited to 'sys/kern/kern_descrip.c')
-rw-r--r-- | sys/kern/kern_descrip.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/sys/kern/kern_descrip.c b/sys/kern/kern_descrip.c index da3bf4c..e5dec1c 100644 --- a/sys/kern/kern_descrip.c +++ b/sys/kern/kern_descrip.c @@ -1303,7 +1303,7 @@ fdcloseexec(td) /* * Internal form of close. * Decrement reference count on file structure. - * Note: p may be NULL when closing a file + * Note: td may be NULL when closing a file * that was being passed in a message. */ int @@ -1311,7 +1311,6 @@ closef(fp, td) register struct file *fp; register struct thread *td; { - struct proc *p = td->td_proc; struct vnode *vp; struct flock lf; @@ -1325,13 +1324,15 @@ closef(fp, td) * If the descriptor was in a message, POSIX-style locks * aren't passed with the descriptor. */ - if (p && (p->p_flag & P_ADVLOCK) && fp->f_type == DTYPE_VNODE) { + if (td && (td->td_proc->p_flag & P_ADVLOCK) && + fp->f_type == DTYPE_VNODE) { lf.l_whence = SEEK_SET; lf.l_start = 0; lf.l_len = 0; lf.l_type = F_UNLCK; vp = (struct vnode *)fp->f_data; - (void) VOP_ADVLOCK(vp, (caddr_t)p->p_leader, F_UNLCK, &lf, F_POSIX); + (void) VOP_ADVLOCK(vp, (caddr_t)td->td_proc->p_leader, + F_UNLCK, &lf, F_POSIX); } return (fdrop(fp, td)); } |