o Make kqueue's filt_procattach() function use the error value returned

by p_can(...P_CAN_SEE), rather than returning EACCES directly.  This
  brings the error code used here into line with similar arrangements
  elsewhere, and prevents the leakage of pid usage information.

Reviewed by:	jlemon
Obtained from:	TrustedBSD Project
This commit is contained in:
Robert Watson 2001-04-12 21:32:02 +00:00
parent d34f8d3030
commit e386f9bda3

View File

@ -165,12 +165,13 @@ static int
filt_procattach(struct knote *kn) filt_procattach(struct knote *kn)
{ {
struct proc *p; struct proc *p;
int error;
p = pfind(kn->kn_id); p = pfind(kn->kn_id);
if (p == NULL) if (p == NULL)
return (ESRCH); return (ESRCH);
if (p_can(curproc, p, P_CAN_SEE, NULL)) if ((error = p_can(curproc, p, P_CAN_SEE, NULL)))
return (EACCES); return (error);
kn->kn_ptr.p_proc = p; kn->kn_ptr.p_proc = p;
kn->kn_flags |= EV_CLEAR; /* automatically set */ kn->kn_flags |= EV_CLEAR; /* automatically set */