diff options
author | James Clarke <jrtc27@jrtc27.com> | 2017-10-07 18:53:24 +0100 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2017-10-31 15:23:55 +0100 |
commit | 6bcc2c0f6cb868232ec06231aa37a3fa65c59d22 (patch) | |
tree | 3a72a8f7514b8553475dd0e3071bd90d632461aa /libbb/find_root_device.c | |
parent | 59a5604a795ef5ba850e99a3aafc5b015dd237a1 (diff) | |
download | busybox-6bcc2c0f6cb868232ec06231aa37a3fa65c59d22.tar.gz |
grep: skip grepping symlinks to directories
When grep is passed -r, recursive_action will treat any symlinks to
directories not in the root as normal files, since it lstat's them and
is therefore told they are not directories. However, file_action_grep
will still try to fopen and read from them to see whether they match,
which varies in behaviour across platforms. Linux will give EISDIR and
thus grep will not find any matching lines, but FreeBSD will give the
raw contents of the directory itself, which may match the given pattern.
Also, if grep is passed -c, it will even print a count for these
symlinks, even on Linux.
Since this recursive_action behaviour is required for the correct
functioning of other applets, such as tar, grep should handle this
special case and skip any such symlinks.
function old new delta
file_action_grep 80 161 +81
Signed-off-by: James Clarke <jrtc27@jrtc27.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'libbb/find_root_device.c')
0 files changed, 0 insertions, 0 deletions