From owner-freebsd-audit Wed Aug 22 2:15:59 2001 Delivered-To: freebsd-audit@freebsd.org Received: from falcon.mail.pas.earthlink.net (falcon.mail.pas.earthlink.net [207.217.120.74]) by hub.freebsd.org (Postfix) with ESMTP id AEC7A37B403; Wed, 22 Aug 2001 02:15:53 -0700 (PDT) (envelope-from cjc@earthlink.net) Received: from blossom.cjclark.org (dialup-209.245.133.160.Dial1.SanJose1.Level3.net [209.245.133.160]) by falcon.mail.pas.earthlink.net (EL-8_9_3_3/8.9.3) with ESMTP id CAA10809; Wed, 22 Aug 2001 02:15:51 -0700 (PDT) Received: (from cjc@localhost) by blossom.cjclark.org (8.11.4/8.11.3) id f7M9FoK76940; Wed, 22 Aug 2001 02:15:50 -0700 (PDT) (envelope-from cjc) Date: Wed, 22 Aug 2001 02:15:50 -0700 From: "Crist J. Clark" To: Ruslan Ermilov Cc: freebsd-audit@FreeBSD.ORG Subject: Re: syslogd(8) Hostname Upgrade Message-ID: <20010822021550.L313@blossom.cjclark.org> Reply-To: cjclark@alum.mit.edu References: <20010822013841.A76483@blossom.cjclark.org> <20010822115024.A23430@sunbay.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: <20010822115024.A23430@sunbay.com>; from ru@FreeBSD.ORG on Wed, Aug 22, 2001 at 11:50:24AM +0300 Sender: owner-freebsd-audit@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On Wed, Aug 22, 2001 at 11:50:24AM +0300, Ruslan Ermilov wrote: > On Wed, Aug 22, 2001 at 01:38:41AM -0700, Crist J. Clark wrote: > [...] > > + if (gethostname(LocalHostName, sizeof(LocalHostName))) > > Check explicitly against -1. Since, gethostname(3) says, RETURN VALUES If the call succeeds a value of 0 is returned. I figured the safest way was to verify that the return value was zero rather than look for a specific failure mode (of course, -1 is listed as the only one). > > + err(EX_OSERR, "gethostname failed"); > > Add "()" after "gethostname". 'K. > > + if (signo && strcmp(oldLocalHostName, LocalHostName)) { > > I'm always confused when seeing this. IMHO, ``strcmp(...) != 0'' > is much better. I had done it that way because earlier lines wrapped in un-pretty ways. But I personally prefer, if (signo != 0 && strcmp(oldLocalHostName, LocalHostName) != 0) { For clarity too (and IIRC K&R recommend that style ;), and it fits on one line. -- Crist J. Clark cjclark@alum.mit.edu To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-audit" in the body of the message