diff options
author | Tavian Barnes <tavianator@tavianator.com> | 2021-06-13 15:53:06 -0400 |
---|---|---|
committer | Tavian Barnes <tavianator@tavianator.com> | 2021-06-13 16:10:13 -0400 |
commit | db67752672877ea0f5360699cb34ad31065ef39e (patch) | |
tree | 974bed22b2ed747a2c7b9cf5b1f57a370a646df3 /spawn.h | |
parent | ae15c5abe0bb2d8bd5fd3502721288bcb1a85d59 (diff) | |
download | bfs-db67752672877ea0f5360699cb34ad31065ef39e.tar.xz |
spawn: New function for resolving executables in the PATH
This fixes the BFS_SPAWN_USEPATH to use the parent's environment, not
the new child's environment, to resolve the executable.
Diffstat (limited to 'spawn.h')
-rw-r--r-- | spawn.h | 13 |
1 files changed, 13 insertions, 0 deletions
@@ -107,4 +107,17 @@ int bfs_spawn_addsetrlimit(struct bfs_spawn *ctx, int resource, const struct rli */ pid_t bfs_spawn(const char *exe, const struct bfs_spawn *ctx, char **argv, char **envp); +/** + * Look up an executable in the current PATH, as BFS_SPAWN_USEPATH or execvp() + * would do. + * + * @param exe + * The name of the binary to execute. Bare names without a '/' will be + * searched on the provided PATH. + * @return + * The full path to the executable, which should be free()'d, or NULL on + * failure. + */ +char *bfs_spawn_resolve(const char *exe); + #endif // BFS_SPAWN_H |