From owner-freebsd-bugs Mon Jan 22 12:10:22 2001 Delivered-To: freebsd-bugs@hub.freebsd.org Received: from freefall.freebsd.org (freefall.FreeBSD.org [216.136.204.21]) by hub.freebsd.org (Postfix) with ESMTP id E5E9537B6A3 for ; Mon, 22 Jan 2001 12:10:02 -0800 (PST) Received: (from gnats@localhost) by freefall.freebsd.org (8.11.1/8.11.1) id f0MKA2185498; Mon, 22 Jan 2001 12:10:02 -0800 (PST) (envelope-from gnats) Date: Mon, 22 Jan 2001 12:10:02 -0800 (PST) Message-Id: <200101222010.f0MKA2185498@freefall.freebsd.org> To: freebsd-bugs@FreeBSD.org Cc: From: Garrett Wollman Subject: Re: bin/24540: add '-c' flag to src/bin/domainname to clear domainname Reply-To: Garrett Wollman Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org The following reply was made to PR bin/24540; it has been noted by GNATS. From: Garrett Wollman To: Pete Fritchman 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) < 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 To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message