summaryrefslogtreecommitdiffstats
path: root/spawn.h
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@tavianator.com>2021-06-13 15:53:06 -0400
committerTavian Barnes <tavianator@tavianator.com>2021-06-13 16:10:13 -0400
commitdb67752672877ea0f5360699cb34ad31065ef39e (patch)
tree974bed22b2ed747a2c7b9cf5b1f57a370a646df3 /spawn.h
parentae15c5abe0bb2d8bd5fd3502721288bcb1a85d59 (diff)
downloadbfs-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.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/spawn.h b/spawn.h
index 16815bb..7bae89c 100644
--- a/spawn.h
+++ b/spawn.h
@@ -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