Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 16 May 2002 00:17:59 +0300
From:      Giorgos Keramidas <keramida@FreeBSD.org>
To:        Mike Makonnen <makonnen@pacbell.net>
Cc:        freebsd-audit@FreeBSD.org
Subject:   Re: RFC: Port of NetBSD cat(1)'s -f option.
Message-ID:  <20020515211758.GB68380@hades.hell.gr>
In-Reply-To: <1021491063.45509.645.camel@kokeb.ambesa.net>
References:  <20020515061827.GA47688@hades.hell.gr> <1021491063.45509.645.camel@kokeb.ambesa.net>

next in thread | previous in thread | raw e-mail | index | archive | help
In message: <1021491063.45509.645.camel@kokeb.ambesa.net>
            Mike Makonnen <makonnen@pacbell.net> 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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20020515211758.GB68380>