Skip to content
Merged
Changes from 4 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
13 changes: 12 additions & 1 deletion compiler-rt/test/sanitizer_common/TestCases/Posix/posix_spawn.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,12 @@
#include <assert.h>
#include <spawn.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/wait.h>

extern char **environ;
Comment thread
ndrewh marked this conversation as resolved.

int main(int argc, char **argv) {
if (argc > 1) {
// CHECK: SPAWNED
Expand All @@ -23,11 +27,18 @@ int main(int argc, char **argv) {
argv[0], "2", "3", "4", "2", "3", "4", "2", "3", "4",
"2", "3", "4", "2", "3", "4", "2", "3", "4", NULL,
};
char *const env[] = {
char *env[] = {
"A=B", "A=B", "A=B", "A=B", "A=B", "A=B", "A=B", "A=B", "A=B", "A=B",
"A=B", "A=B", "A=B", "A=B", "A=B", "A=B", "A=B", "A=B", "A=B", NULL,
};

Comment thread
ndrewh marked this conversation as resolved.
for (char **e = environ; *e; e++) {
Comment thread
ndrewh marked this conversation as resolved.
Outdated
if (strncmp(*e, "DYLD_LIBRARY_PATH=", sizeof("DYLD_LIBRARY_PATH=") - 1) ==
Comment thread
DanBlackwell marked this conversation as resolved.
0) {
env[0] = *e;
}
}

pid_t pid;
int s = posix_spawn(&pid, argv[0], &file_actions, &attr, args, env);
assert(!s);
Expand Down