diff options
author | jh <jh@FreeBSD.org> | 2009-11-26 19:11:44 +0000 |
---|---|---|
committer | jh <jh@FreeBSD.org> | 2009-11-26 19:11:44 +0000 |
commit | 9d7cf052cd6d24448402e219eb3edf32a8516f4b (patch) | |
tree | 090e327f3d9c362f2672b29775d7bb53777bd504 /lib | |
parent | b0e5c93d265f054fc567475798ffca846854d375 (diff) | |
download | FreeBSD-src-9d7cf052cd6d24448402e219eb3edf32a8516f4b.zip FreeBSD-src-9d7cf052cd6d24448402e219eb3edf32a8516f4b.tar.gz |
Reset path name back to original correctly in fts_build() when
FTS_NOCHDIR option is used. fts_build() could strip a trailing slash
from path name in post-order visit if a path pointing to an empty
directory was given for fts_open().
PR: bin/133907, kern/134513
Reviewed by: das
Approved by: trasz (mentor)
MFC after: 1 month
Diffstat (limited to 'lib')
-rw-r--r-- | lib/libc/gen/fts.c | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/lib/libc/gen/fts.c b/lib/libc/gen/fts.c index 392bda9..1c547a1 100644 --- a/lib/libc/gen/fts.c +++ b/lib/libc/gen/fts.c @@ -842,11 +842,8 @@ mem1: saved_errno = errno; * If not changing directories, reset the path back to original * state. */ - if (ISSET(FTS_NOCHDIR)) { - if (len == sp->fts_pathlen || nitems == 0) - --cp; - *cp = '\0'; - } + if (ISSET(FTS_NOCHDIR)) + sp->fts_path[cur->fts_pathlen] = '\0'; /* * If descended after called from fts_children or after called from |