Ticket #30483: xinit.tiger.patch

File xinit.tiger.patch, 1.4 KB (added by jeremyhu (Jeremy Huddleston Sequoia), 13 years ago)

tiger patch

  • launchd/user_startx/launchd_startx.c

    diff --git a/launchd/user_startx/launchd_startx.c b/launchd/user_startx/launchd_startx.c
    index e3fae76..d6d2a92 100644
    a b  
    3434#include <unistd.h>
    3535#include <stdio.h>
    3636#include <assert.h>
    37 #include <spawn.h>
    3837#include <sys/wait.h>
    3938#include <string.h>
    4039#include <stdlib.h>
    4140
     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
    4250#include "console_redirect.h"
    4351
    44 int main(int argc, char **argv, char **envp) {
     52int  main(int argc, char **argv, char **envp) {
    4553    aslclient aslc;
    4654    pid_t child;
    4755    int pstat;
    int main(int argc, char **argv, char **envp) { 
    5664    xi_asl_capture_fd(aslc, NULL, ASL_LEVEL_INFO, STDOUT_FILENO);
    5765    xi_asl_capture_fd(aslc, NULL, ASL_LEVEL_NOTICE, STDERR_FILENO);
    5866
     67#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1050
    5968    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
    6080
    6181    wait4(child, &pstat, 0, (struct rusage *)0);
    6282