Date: Tue, 23 Jan 2001 12:16:37 +0200 From: Peter Pentchev <roam@orbitel.bg> To: Garrett Wollman <wollman@khavrinen.lcs.mit.edu> Cc: freebsd-bugs@FreeBSD.org, freebsd-arch@FreeBSD.org Subject: Re: bin/24540: add '-c' flag to src/bin/domainname to clear domainname Message-ID: <20010123121637.E2376@ringworld.oblivion.bg> In-Reply-To: <200101222010.f0MKA2185498@freefall.freebsd.org>; from wollman@khavrinen.lcs.mit.edu on Mon, Jan 22, 2001 at 12:10:02PM -0800 References: <200101222010.f0MKA2185498@freefall.freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
On Mon, Jan 22, 2001 at 12:10:02PM -0800, Garrett Wollman wrote: > The following reply was made to PR bin/24540; it has been noted by GNATS. > > From: Garrett Wollman <wollman@khavrinen.lcs.mit.edu> > To: Pete Fritchman <petef@databits.net> > Cc: freebsd-gnats-submit@FreeBSD.ORG, phk@FreeBSD.ORG > Subject: Re: bin/24540: add '-c' flag to src/bin/domainname to clear domainname > Date: Mon, 22 Jan 2001 15:02:57 -0500 (EST) > > <<On Mon, 22 Jan 2001 11:10:02 -0800 (PST), Pete Fritchman <petef@databits.net> said: > > > electron# ./domainname foo.bar > > electron# ./domainname '' > > electron# ./domainname > > foo.bar > > I think this is a bug in sysctl. Note the following: > > root@khavrinen(6)# sysctl -w kern.domainname='' > kern.domainname: foo.bar -> foo.bar > > What is happening is that the sysctl() system call is interpreting the > request to set the MIB variable to a zero-length object as if it were > an indication that setting is not requested. Here is an (untested) > fix (beware cut&paste has bogotified whitespace): > > > > --- kern_sysctl.c 2000/07/28 22:40:04 1.100 > +++ kern_sysctl.c 2001/01/22 20:01:38 > @@ -862,7 +862,7 @@ > req.oldptr= old; > } > > - if (newlen) { > + if (new) { > req.newlen = newlen; > req.newptr = new; > } > @@ -1101,7 +1101,7 @@ > req.oldptr= old; > } > > - if (newlen) { > + if (new) { > if (!useracc(new, req.newlen, VM_PROT_READ)) > return (EFAULT); > req.newlen = newlen; > > -GAWollman This works for me; still, how about changing the test to if (newlen || (new != NULL)) in both places? I have a -current system which has been running fine for three hours now with this fix, and there have been no signs of breakage (there shouldn't be, unless somewhere someone passes uninit'd values to new or newval). -arch CC'd because of the proposed kern_sysctl change :) G'luck, Peter -- Nostalgia ain't what it used to be. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20010123121637.E2376>