summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@tavianator.com>2016-11-21 14:20:29 -0500
committerTavian Barnes <tavianator@tavianator.com>2016-11-21 14:20:29 -0500
commitcd09f52da8596295841cb832d84f0e728bff449d (patch)
tree83823509a3fe543f3000e1fe002f1538d0d682c0
parent059e23e9227d300c1608262808c5f4043abe50f1 (diff)
downloadbfs-cd09f52da8596295841cb832d84f0e728bff449d.tar.xz
Fix -execdir for root paths with no slashes.
-rw-r--r--eval.c6
-rw-r--r--tests/test_0064.out2
2 files changed, 6 insertions, 2 deletions
diff --git a/eval.c b/eval.c
index 80df040..16c4dac 100644
--- a/eval.c
+++ b/eval.c
@@ -388,7 +388,11 @@ static void exec_chdir(const struct BFTW *ftwbuf) {
while (end > path && end[-1] != '/') {
--end;
}
- if (end > path) {
+ if (end == path) {
+ // The path is something like "foo", so we're already in the
+ // right directory
+ return;
+ } else {
*end = '\0';
}
diff --git a/tests/test_0064.out b/tests/test_0064.out
index 97e97f9..e66db9a 100644
--- a/tests/test_0064.out
+++ b/tests/test_0064.out
@@ -1,4 +1,4 @@
-basic
+
basic
basic
basic