[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] grep: -r no follows symlinks
From: |
Jim Meyering |
Subject: |
Re: [PATCH] grep: -r no follows symlinks |
Date: |
Wed, 14 Mar 2012 20:39:56 +0100 |
Paul Eggert wrote:
> Thanks for the review. Here's a followup that takes your
> suggestions into account.
All of the rest looks fine, too.
Only one suggestion:
> Subject: [PATCH] grep: -r no longer follows symlinks; use fts
...
> + if (S_ISCHR (st->st_mode) || S_ISBLK (st->st_mode)
> + || S_ISSOCK (st->st_mode) || S_ISFIFO (st->st_mode))
> + return 1;
...
> + if ((directories == SKIP_DIRECTORIES && S_ISDIR (st.st_mode))
> + || ((devices == SKIP_DEVICES
> + || (devices == READ_COMMAND_LINE_DEVICES && !command_line))
> + && (S_ISCHR (st.st_mode)
> + || S_ISBLK (st.st_mode)
> + || S_ISSOCK (st.st_mode)
> + || S_ISFIFO (st.st_mode))))
> + goto closeout;
With the same 4-term disjunct in two places,
we might as well give it a name and factor it out.
Thanks for doing all that work.
Do you know anyone who might be prepared to convert copy.c or ls.c
in a similar manner? Those are the only remaining dir-traversing
coreutils programs that fail due to names longer than PATH_MAX.