diff options
author | Jim Meyering <meyering@redhat.com> | 2012-04-12 20:45:16 +0200 |
---|---|---|
committer | Jim Meyering <meyering@redhat.com> | 2012-04-13 10:52:43 +0200 |
commit | 40679f5dbbb710bc3d09e0f410379fae20ba65e7 (patch) | |
tree | 24e9875a967184630f08a3879f7eabd9a42a4099 /src | |
parent | 92449ffdc47f1e7dd01fbc110eb094977dafb66a (diff) | |
download | grep-40679f5dbbb710bc3d09e0f410379fae20ba65e7.tar.gz |
grep: handle symlinked directory loops as usual
* src/main.c (grepfile): Treat EMLINK just like ELOOP, for
systems like FreeBSD 9.0 on which we would otherwise report
"Too many links" rather than ignoring that type of failure.
E.g., "mkdir d; cd d; ln -s . a; grep -r ^" would print
grep: a: Too many links and would exit with status 2.
Now, it prints nothing and exits with status 1, as before.
Reported by Nelson H. F. Beebe.
Diffstat (limited to 'src')
-rw-r--r-- | src/main.c | 2 |
1 files changed, 1 insertions, 1 deletions
@@ -1311,7 +1311,7 @@ grepfile (int dirdesc, char const *name, int follow, int command_line) int desc = openat_safer (dirdesc, name, O_RDONLY | (follow ? 0 : O_NOFOLLOW)); if (desc < 0) { - if (follow || errno != ELOOP) + if (follow || (errno != ELOOP && errno != EMLINK)) suppressible_error (filename, errno); return 1; } |