summaryrefslogtreecommitdiffstats
path: root/exec.c
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@tavianator.com>2019-06-16 14:55:47 -0400
committerTavian Barnes <tavianator@tavianator.com>2019-06-16 15:00:17 -0400
commit53fffe30cbdd2422dbbc648677faef4eb2c6c43e (patch)
tree04f8790dbbee18f346ead8d579deb7206ae2f01c /exec.c
parent78dfcf6237400281940a7bd97c05ac18eb69c577 (diff)
downloadbfs-53fffe30cbdd2422dbbc648677faef4eb2c6c43e.tar.xz
exec: Assert that at_fd is the immediate parent
Diffstat (limited to 'exec.c')
-rw-r--r--exec.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/exec.c b/exec.c
index 3a35063..ddca2f9 100644
--- a/exec.c
+++ b/exec.c
@@ -266,6 +266,9 @@ static int bfs_exec_openwd(struct bfs_exec *execbuf, const struct BFTW *ftwbuf)
assert(!execbuf->wd_path);
if (ftwbuf->at_fd != AT_FDCWD) {
+ // Rely on at_fd being the immediate parent
+ assert(ftwbuf->at_path == xbasename(ftwbuf->at_path));
+
execbuf->wd_fd = ftwbuf->at_fd;
if (!(execbuf->flags & BFS_EXEC_MULTI)) {
return 0;