From 53fffe30cbdd2422dbbc648677faef4eb2c6c43e Mon Sep 17 00:00:00 2001 From: Tavian Barnes Date: Sun, 16 Jun 2019 14:55:47 -0400 Subject: exec: Assert that at_fd is the immediate parent --- exec.c | 3 +++ 1 file changed, 3 insertions(+) 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; -- cgit v1.2.3