FreeBSD Bugzilla – Attachment 190957 Details for
Bug 226166
[PATCH] fts(3): setting FTS_FOLLOW for children does not work as expected when FTS_NOCHDIR is set
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
patch to fix FTS_FOLLOW when set on entries returned by fts_children()
fts-follow-for-fts_children.patch (text/plain), 1.26 KB, created by
Jan Kokemüller
on 2018-02-24 13:11:01 UTC
(
hide
)
Description:
patch to fix FTS_FOLLOW when set on entries returned by fts_children()
Filename:
MIME Type:
Creator:
Jan Kokemüller
Created:
2018-02-24 13:11:01 UTC
Size:
1.26 KB
patch
obsolete
>diff --git a/lib/libc/gen/fts.c b/lib/libc/gen/fts.c >index eda1722139c6..e253145c3677 100644 >--- a/lib/libc/gen/fts.c >+++ b/lib/libc/gen/fts.c >@@ -303,7 +303,7 @@ fts_close(FTS *sp) > FTSENT * > fts_read(FTS *sp) > { >- FTSENT *p, *tmp; >+ FTSENT *p, *tmp = NULL; > int instr; > char *t; > int saved_errno; >@@ -415,16 +415,26 @@ next: tmp = p; > return (sp->fts_cur = p); > } > >+ free(tmp); >+ > /* > * User may have called fts_set on the node. If skipped, > * ignore. If followed, get a file descriptor so we can > * get back if necessary. > */ > if (p->fts_instr == FTS_SKIP) { >- free(tmp); > goto next; > } >- if (p->fts_instr == FTS_FOLLOW) { >+ >+name: t = sp->fts_path + NAPPEND(p->fts_parent); >+ *t++ = '/'; >+ memmove(t, p->fts_name, p->fts_namelen + 1); >+ >+ /* >+ * The tmp check ensures that we don't enter here from the >+ * 'goto name;' above. >+ */ >+ if (tmp && p->fts_instr == FTS_FOLLOW) { > p->fts_info = fts_stat(sp, p, 1, -1); > if (p->fts_info == FTS_D && !ISSET(FTS_NOCHDIR)) { > if ((p->fts_symfd = >@@ -437,11 +447,6 @@ next: tmp = p; > p->fts_instr = FTS_NOINSTR; > } > >- free(tmp); >- >-name: t = sp->fts_path + NAPPEND(p->fts_parent); >- *t++ = '/'; >- memmove(t, p->fts_name, p->fts_namelen + 1); > return (sp->fts_cur = p); > } >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 226166
: 190957