Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F107173850
D46255.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D46255.diff
View Options
diff --git a/usr.bin/grep/util.c b/usr.bin/grep/util.c
--- a/usr.bin/grep/util.c
+++ b/usr.bin/grep/util.c
@@ -136,16 +136,16 @@
/* This switch effectively initializes 'fts_flags' */
switch(linkbehave) {
case LINK_EXPLICIT:
- fts_flags = FTS_COMFOLLOW;
+ fts_flags = FTS_COMFOLLOW | FTS_PHYSICAL;
break;
case LINK_SKIP:
fts_flags = FTS_PHYSICAL;
break;
default:
- fts_flags = FTS_LOGICAL;
+ fts_flags = FTS_LOGICAL | FTS_NOSTAT;
}
- fts_flags |= FTS_NOSTAT | FTS_NOCHDIR;
+ fts_flags |= FTS_NOCHDIR;
fts = fts_open((argv[0] == NULL) ?
__DECONST(char * const *, wd) : argv, fts_flags, NULL);
@@ -154,15 +154,13 @@
while (errno = 0, (p = fts_read(fts)) != NULL) {
switch (p->fts_info) {
case FTS_DNR:
- /* FALLTHROUGH */
case FTS_ERR:
+ case FTS_NS:
file_err = true;
if(!sflag)
- warnx("%s: %s", p->fts_path, strerror(p->fts_errno));
+ warnc(p->fts_errno, "%s", p->fts_path);
break;
case FTS_D:
- /* FALLTHROUGH */
- case FTS_DP:
if (dexclude || dinclude)
if (!dir_matching(p->fts_name) ||
!dir_matching(p->fts_path))
@@ -173,6 +171,17 @@
warnx("warning: %s: recursive directory loop",
p->fts_path);
break;
+ case FTS_DP:
+ break;
+ case FTS_SL:
+ /*
+ * Skip symlinks for LINK_EXPLICIT and
+ * LINK_SKIP. Note that due to FTS_COMFOLLOW,
+ * symlinks on the command line are followed
+ * for LINK_EXPLICIT and not reported as
+ * symlinks.
+ */
+ break;
default:
/* Check for file exclusion/inclusion */
ok = true;
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Jan 12, 6:06 AM (21 h, 3 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
15762289
Default Alt Text
D46255.diff (1 KB)
Attached To
Mode
D46255: grep: Fix various bugs in recursive tree handling
Attached
Detach File
Event Timeline
Log In to Comment