From owner-freebsd-audit Wed May 15 14:18:31 2002 Delivered-To: freebsd-audit@freebsd.org Received: from mailsrv.otenet.gr (mailsrv.otenet.gr [195.170.0.5]) by hub.freebsd.org (Postfix) with ESMTP id 4085237B40D for ; Wed, 15 May 2002 14:18:05 -0700 (PDT) Received: from hades.hell.gr (patr530-b174.otenet.gr [212.205.244.182]) by mailsrv.otenet.gr (8.12.3/8.12.3) with ESMTP id g4FLI2HL027105; Thu, 16 May 2002 00:18:03 +0300 (EEST) Received: from hades.hell.gr (hades [127.0.0.1]) by hades.hell.gr (8.12.3/8.12.3) with ESMTP id g4FLI16m068466; Thu, 16 May 2002 00:18:01 +0300 (EEST) (envelope-from keramida@ceid.upatras.gr) Received: (from charon@localhost) by hades.hell.gr (8.12.3/8.12.3/Submit) id g4FLI0qp068465; Thu, 16 May 2002 00:18:00 +0300 (EEST) (envelope-from keramida@ceid.upatras.gr) Date: Thu, 16 May 2002 00:17:59 +0300 From: Giorgos Keramidas To: Mike Makonnen Cc: freebsd-audit@FreeBSD.org Subject: Re: RFC: Port of NetBSD cat(1)'s -f option. Message-ID: <20020515211758.GB68380@hades.hell.gr> References: <20020515061827.GA47688@hades.hell.gr> <1021491063.45509.645.camel@kokeb.ambesa.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1021491063.45509.645.camel@kokeb.ambesa.net> User-Agent: Mutt/1.3.99i 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 In message: <1021491063.45509.645.camel@kokeb.ambesa.net> Mike Makonnen writes: > > @@ -138,7 +141,15 @@ > > filename = "stdin"; > > fd = STDIN_FILENO; > > } else { > > + struct stat st; > > + > > filename = path; > > + if (stat(path, &st) < 0 || > > + S_ISREG(st.st_mode) == 0) { > > + i++; /* Skip to next file. */ > > + continue; > > + } > > + > > just a minor nit, > > You might want to show a warning, since stat(2) can fail for any number > of reasons not related to the type of file. 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) == 0) { + i++; /* Skip to next file. */ + continue; + } %%% -- Giorgos Keramidas - http://www.FreeBSD.org keramida@FreeBSD.org - The Power to Serve To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-audit" in the body of the message