From owner-freebsd-audit Thu May 16 3:41:36 2002 Delivered-To: freebsd-audit@freebsd.org Received: from south.nanolink.com (south.nanolink.com [217.75.134.10]) by hub.freebsd.org (Postfix) with SMTP id 92BDA37B401 for ; Thu, 16 May 2002 03:41:31 -0700 (PDT) Received: (qmail 37484 invoked from network); 16 May 2002 10:49:22 -0000 Received: from unknown (HELO straylight.ringlet.net) (212.116.140.125) by south.nanolink.com with SMTP; 16 May 2002 10:49:22 -0000 Received: (qmail 4496 invoked by uid 1000); 16 May 2002 10:40:45 -0000 Date: Thu, 16 May 2002 13:40:45 +0300 From: Peter Pentchev To: Bruce Evans Cc: Giorgos Keramidas , Mike Makonnen , freebsd-audit@FreeBSD.ORG Subject: Re: RFC: Port of NetBSD cat(1)'s -f option. Message-ID: <20020516134044.A349@straylight.oblivion.bg> Mail-Followup-To: Bruce Evans , Giorgos Keramidas , Mike Makonnen , freebsd-audit@FreeBSD.ORG References: <20020515211758.GB68380@hades.hell.gr> <20020516164332.B1704-100000@gamplex.bde.org> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-md5; protocol="application/pgp-signature"; boundary="a8Wt8u1KmwUX3Y2C" Content-Disposition: inline User-Agent: Mutt/1.2.5.1i In-Reply-To: <20020516164332.B1704-100000@gamplex.bde.org>; from bde@zeta.org.au on Thu, May 16, 2002 at 05:40:01PM +1000 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 --a8Wt8u1KmwUX3Y2C Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, May 16, 2002 at 05:40:01PM +1000, Bruce Evans wrote: > On Thu, 16 May 2002, Giorgos Keramidas wrote: [snip] > > Sure, I've changed it to the following. Since this is a minor change, > > I'll see that is gets done later tonight, if nobody objects 'til then. > > > > %%% > > + if (stat(path, &st) < 0) { > > + warn("%s", path); > > + i++; /* Skip to next file. */ > > + continue; > > + } > > + if (S_ISREG(st.st_mode) =3D=3D 0) { > > + i++; /* Skip to next file. */ > > + continue; > > + } > > %%% [snip] > Style bugs: > - nested declaration of st. > - more verbose and bogus handling of the variable 'i'. 'i' is just the > loop counter for a `for' loop that is obfuscated as a `while' loop. Also, aren't we supposed to test the return values of syscalls explicitly against -1, and not just < 0? At least that was the impression that Ruslan gave me some time ago.. G'luck, Peter --=20 Peter Pentchev roam@ringlet.net roam@FreeBSD.org PGP key: http://people.FreeBSD.org/~roam/roam.key.asc Key fingerprint FDBA FD79 C26F 3C51 C95E DF9E ED18 B68D 1619 4553 Nostalgia ain't what it used to be. --a8Wt8u1KmwUX3Y2C Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.0.7 (FreeBSD) iD8DBQE844ys7Ri2jRYZRVMRArWxAKCpDS3wb5U1zAB1iiGVdA7vlYoN4QCfVpK7 jOoqby5+92LWuDNEaHalKw4= =q3r1 -----END PGP SIGNATURE----- --a8Wt8u1KmwUX3Y2C-- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-audit" in the body of the message