Date: Sat, 17 Mar 2001 10:06:51 +0000 From: David Malone <dwmalone@maths.tcd.ie> To: Dima Dorfman <dima@unixfreak.org> Cc: hackers@freebsd.org Subject: Re: sysctl_kern_proc doesn't handle the case when no procs match given criteria Message-ID: <20010317100651.A24995@walton.maths.tcd.ie> In-Reply-To: <20010317042351.C1B283E23@bazooka.unixfreak.org>; from dima@unixfreak.org on Fri, Mar 16, 2001 at 08:23:51PM -0800 References: <20010317042351.C1B283E23@bazooka.unixfreak.org>
next in thread | previous in thread | raw e-mail | index | archive | help
On Fri, Mar 16, 2001 at 08:23:51PM -0800, Dima Dorfman wrote: > Obviously, this isn't the desired mode of failure. Attached is a > patch that will make sysctl_kern_proc return ESRCH if it didn't find > any processes. AFAIK, without the patch, the only way to detect this > condition (no processes match search criteria) is to check that a call > into this routine via sysctl didn't modify whatever is pointed at by > the oldp pointer (see sysctl(3)). I went for a much simpler patch that just skipped the struct size check if the amount of data returned was zero. This is what the old code did (effectively) before the the struct size check changed. (Patch just posted to -current). David. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20010317100651.A24995>