diff --git a/launchd/user_startx/launchd_startx.c b/launchd/user_startx/launchd_startx.c
index e3fae76..d6d2a92 100644
a
|
b
|
|
34 | 34 | #include <unistd.h> |
35 | 35 | #include <stdio.h> |
36 | 36 | #include <assert.h> |
37 | | #include <spawn.h> |
38 | 37 | #include <sys/wait.h> |
39 | 38 | #include <string.h> |
40 | 39 | #include <stdlib.h> |
41 | 40 | |
| 41 | /* Using MIN_REQUIRED instead of MAX_ALLOWED logic due to posix_spawn not |
| 42 | * being marked with availability macros until 10.7 |
| 43 | */ |
| 44 | #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1050 |
| 45 | #include <spawn.h> |
| 46 | #else |
| 47 | #include <errno.h> |
| 48 | #endif |
| 49 | |
42 | 50 | #include "console_redirect.h" |
43 | 51 | |
44 | | int main(int argc, char **argv, char **envp) { |
| 52 | int main(int argc, char **argv, char **envp) { |
45 | 53 | aslclient aslc; |
46 | 54 | pid_t child; |
47 | 55 | int pstat; |
… |
… |
int main(int argc, char **argv, char **envp) { |
56 | 64 | xi_asl_capture_fd(aslc, NULL, ASL_LEVEL_INFO, STDOUT_FILENO); |
57 | 65 | xi_asl_capture_fd(aslc, NULL, ASL_LEVEL_NOTICE, STDERR_FILENO); |
58 | 66 | |
| 67 | #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1050 |
59 | 68 | assert(posix_spawnp(&child, argv[1], NULL, NULL, &argv[1], envp) == 0); |
| 69 | #else |
| 70 | switch(child = fork()) { |
| 71 | case -1: |
| 72 | perror("fork"); |
| 73 | return errno; |
| 74 | case 0: |
| 75 | return execvp(argv[1], &argv[1]); |
| 76 | default: |
| 77 | break; |
| 78 | } |
| 79 | #endif |
60 | 80 | |
61 | 81 | wait4(child, &pstat, 0, (struct rusage *)0); |
62 | 82 | |