Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Correctly detect posix_spawn_file_actions_addchdir[_np] #326

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions cbits/posix/posix_spawn.c
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
// 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 "common.h"

Expand Down Expand Up @@ -25,8 +29,6 @@ do_spawn_posix (char *const args[],

#else

// Necessary for POSIX_SPAWN_SETSID under glibc.
#define _GNU_SOURCE
#include <spawn.h>

extern char **environ;
Expand Down Expand Up @@ -135,13 +137,13 @@ do_spawn_posix (char *const args[],
}

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);
if (r != 0) {
*failed_doing = "posix_spawn_file_actions_addchdir";
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.
// See https://github.com/rust-lang/rust/pull/80537.
r = posix_spawn_file_actions_addchdir_np(&fa, workingDirectory);
Expand Down
Loading