Skip to content
Snippets Groups Projects
Unverified Commit 91e73810 authored by Ben Gamari's avatar Ben Gamari 🐢 Committed by GitHub
Browse files

Merge pull request #326 from adamgundry/wip/303-fix-posix_spawn_file_actions_addchdir_np

Correctly detect posix_spawn_file_actions_addchdir[_np]
parents 85dabea3 f742e7f1
No related branches found
No related tags found
No related merge requests found
// Necessary for POSIX_SPAWN_SETSID and posix_spawn_file_actions_addchdir_np under glibc.
// Moreover this needs to appear before any glibc headers.
#define _GNU_SOURCE
#include "runProcess.h" #include "runProcess.h"
#include "common.h" #include "common.h"
...@@ -25,8 +29,6 @@ do_spawn_posix (char *const args[], ...@@ -25,8 +29,6 @@ do_spawn_posix (char *const args[],
#else #else
// Necessary for POSIX_SPAWN_SETSID under glibc.
#define _GNU_SOURCE
#include <spawn.h> #include <spawn.h>
extern char **environ; extern char **environ;
...@@ -135,13 +137,13 @@ do_spawn_posix (char *const args[], ...@@ -135,13 +137,13 @@ do_spawn_posix (char *const args[],
} }
if (workingDirectory) { if (workingDirectory) {
#if defined(HAVE_posix_spawn_file_actions_addchdir) #if defined(HAVE_POSIX_SPAWN_FILE_ACTIONS_ADDCHDIR)
r = posix_spawn_file_actions_addchdir(&fa, workingDirectory); r = posix_spawn_file_actions_addchdir(&fa, workingDirectory);
if (r != 0) { if (r != 0) {
*failed_doing = "posix_spawn_file_actions_addchdir"; *failed_doing = "posix_spawn_file_actions_addchdir";
goto fail; goto fail;
} }
#elif defined(HAVE_posix_spawn_file_actions_addchdir_np) #elif defined(HAVE_POSIX_SPAWN_FILE_ACTIONS_ADDCHDIR_NP)
// N.B. this function is broken on macOS. // N.B. this function is broken on macOS.
// See https://github.com/rust-lang/rust/pull/80537. // See https://github.com/rust-lang/rust/pull/80537.
r = posix_spawn_file_actions_addchdir_np(&fa, workingDirectory); r = posix_spawn_file_actions_addchdir_np(&fa, workingDirectory);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment