Re: RFC: Port of NetBSD cat(1)'s -f option.

Giorgos Keramidas <[email protected]>
Newsgroups gmane.os.freebsd.devel.audit
Message-ID <[email protected]>
In message: <[email protected]>
            Mike Makonnen <[email protected]> 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
[email protected] - The Power to Serve

To Unsubscribe: send mail to [email protected]
with "unsubscribe freebsd-audit" in the body of the message
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.