]>
Commit | Line | Data |
---|---|---|
a39ff7e2 A |
1 | #include <spawn.h> |
2 | #include <sys/wait.h> | |
3 | #include <darwintest.h> | |
4 | #include <mach-o/dyld.h> | |
5 | #include <errno.h> | |
6 | ||
7 | T_DECL(no32exec_bootarg, "make sure the no32exec boot-arg is honored", T_META_BOOTARGS_SET("-no32exec")) | |
8 | { | |
9 | int spawn_ret, pid; | |
10 | char path[1024]; | |
11 | uint32_t size = sizeof(path); | |
12 | ||
13 | T_ASSERT_EQ(_NSGetExecutablePath(path, &size), 0, NULL); | |
14 | T_ASSERT_LT(strlcat(path, "_helper", size), size, NULL); | |
15 | ||
16 | spawn_ret = posix_spawn(&pid, path, NULL, NULL, NULL, NULL); | |
17 | if (spawn_ret == 0) { | |
18 | int wait_ret = 0; | |
19 | waitpid(pid, &wait_ret, 0); | |
20 | T_ASSERT_FALSE(WIFEXITED(wait_ret), "i386 helper should not run"); | |
21 | } | |
22 | T_ASSERT_EQ(spawn_ret, EBADARCH, NULL); | |
23 | } |