Date: Thu, 16 May 2002 13:40:45 +0300 From: Peter Pentchev <roam@ringlet.net> To: Bruce Evans <bde@zeta.org.au> Cc: Giorgos Keramidas <keramida@FreeBSD.ORG>, Mike Makonnen <makonnen@pacbell.net>, freebsd-audit@FreeBSD.ORG Subject: Re: RFC: Port of NetBSD cat(1)'s -f option. Message-ID: <20020516134044.A349@straylight.oblivion.bg> In-Reply-To: <20020516164332.B1704-100000@gamplex.bde.org>; from bde@zeta.org.au on Thu, May 16, 2002 at 05:40:01PM %2B1000 References: <20020515211758.GB68380@hades.hell.gr> <20020516164332.B1704-100000@gamplex.bde.org>
next in thread | previous in thread | raw e-mail | index | archive | help
--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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20020516134044.A349>
