diff options
author | Tavian Barnes <tavianator@tavianator.com> | 2016-11-24 21:04:56 -0500 |
---|---|---|
committer | Tavian Barnes <tavianator@tavianator.com> | 2016-11-24 21:04:56 -0500 |
commit | e2ee1a956a3b11d1840fc051443923b54339072b (patch) | |
tree | 5bdccd9a43253e799448618556243d3788bb7729 /eval.c | |
parent | 6b820421d9ffe0599d9ff3f20703b2e2a04e4af8 (diff) | |
download | bfs-e2ee1a956a3b11d1840fc051443923b54339072b.tar.xz |
Allow // to be different from /
POSIX says that // may be resolved in an implementation-defined way
(generally, to access network shares). So don't use it in tests, and
don't canonicalize it to '/' in -execdir.
Diffstat (limited to 'eval.c')
-rw-r--r-- | eval.c | 9 |
1 files changed, 4 insertions, 5 deletions
@@ -261,8 +261,6 @@ bool eval_delete(const struct expr *expr, struct eval_state *state) { return true; } -static const char *exec_slash = "/"; - static const char *exec_format_path(const struct expr *expr, const struct BFTW *ftwbuf) { if (!(expr->exec_flags & EXEC_CHDIR)) { return ftwbuf->path; @@ -271,8 +269,9 @@ static const char *exec_format_path(const struct expr *expr, const struct BFTW * const char *name = ftwbuf->path + ftwbuf->nameoff; if (name[0] == '/') { - // Must be the root path ("/", "//", etc.), which we canonicalize - return exec_slash; + // Must be a root path ("/", "//", etc.) + assert(ftwbuf->nameoff == 0); + return name; } // For compatibility with GNU find, use './name' instead of just 'name' @@ -299,7 +298,7 @@ err: } static void exec_free_path(const char *path, const struct BFTW *ftwbuf) { - if (path != ftwbuf->path && path != exec_slash) { + if (path != ftwbuf->path) { dstrfree((char *)path); } } |