summaryrefslogtreecommitdiffstats
path: root/src/xspawn.c
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@tavianator.com>2024-07-27 19:10:16 -0400
committerTavian Barnes <tavianator@tavianator.com>2024-07-27 19:11:39 -0400
commit085bb402c7b2c2f96624fb0523ff3f9686fe26d9 (patch)
tree6c9c4240342fdad2f3d8a131265952659f044e46 /src/xspawn.c
parentc43d54826fd92017b9d7d49a5f660d98c0393e02 (diff)
downloadbfs-085bb402c7b2c2f96624fb0523ff3f9686fe26d9.tar.xz
xspawn: Use _Fork() if available
This completes the workaround for bfs_spawn() hanging on FreeBSD with ASan enabled. Link: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=280318
Diffstat (limited to 'src/xspawn.c')
-rw-r--r--src/xspawn.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/xspawn.c b/src/xspawn.c
index 68973ad..789f370 100644
--- a/src/xspawn.c
+++ b/src/xspawn.c
@@ -612,7 +612,11 @@ static pid_t bfs_fork_spawn(struct bfs_resolver *res, const struct bfs_spawn *ct
goto fail;
}
+#if BFS_HAS__FORK
+ pid_t pid = _Fork();
+#else
pid_t pid = fork();
+#endif
if (pid == 0) {
// Child
bfs_spawn_exec(res, ctx, argv, envp, pipefd);