Date: Fri, 15 Dec 1995 06:04:22 -0800 From: David Greenman <davidg@Root.COM> To: Peter Wemm <peter@freefall.freebsd.org> Cc: CVS-committers@freefall.freebsd.org, cvs-sbin@freefall.freebsd.org Subject: Re: cvs commit: src/sbin/nfsd nfsd.c Message-ID: <199512151404.GAA01840@corbin.Root.COM> In-Reply-To: Your message of "Fri, 15 Dec 95 05:13:36 PST." <199512151313.FAA21119@freefall.freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
>peter 95/12/15 05:13:35 > > Modified: sbin/nfsd nfsd.c > Log: > The version of setproctitle() inside nfsd was busted. It was not terminating > the argv array, causing parts of the argv[0] to be picked up several times > by libkvm, causing strange ps results for the nfs-server and nfs-master > processes.. :-] > > (How many copies of setproctitle() do we need anyway? NetBSD has it in > libc and BSDI have it in libutil.) > > Revision Changes Path > 1.5 +1 -0 src/sbin/nfsd/nfsd.c You realize that it's never really valid to set an argv[x] to NULL, right? It breaks the user environment variables if the process execs (a NULL argv[] pointer is used as the seperation between the args and the environment). Fortunately, 'environ' is initialized at crt0 time, so getenv will continue to work as long as you don't exec. nfsd was expecting the strings for each of argv[*] to be linear in memory. It has code in there to zero out the entire strings area. "LastArg" is the end of the arg strings area. The result of this is that all argv[*] strings each point to a '\0' and thus terminates each of the strings. I don't understand where the garbage comes from. I think the kvm code is bogus and you've just masked the bug with the above change. -DG
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199512151404.GAA01840>