XQuartz: stub: Log directly to ASL rather than stdout/stderr
Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
This commit is contained in:
		
							parent
							
								
									d694601591
								
							
						
					
					
						commit
						c18b7165f9
					
				| 
						 | 
					@ -31,41 +31,43 @@
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include <launch.h>
 | 
					#include <launch.h>
 | 
				
			||||||
#include <stdio.h>
 | 
					#include <asl.h>
 | 
				
			||||||
#include <errno.h>
 | 
					#include <errno.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include "launchd_fd.h"
 | 
					#include "launchd_fd.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					extern aslclient aslc;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
int launchd_display_fd(void) {
 | 
					int launchd_display_fd(void) {
 | 
				
			||||||
    launch_data_t sockets_dict, checkin_request, checkin_response;
 | 
					    launch_data_t sockets_dict, checkin_request, checkin_response;
 | 
				
			||||||
    launch_data_t listening_fd_array, listening_fd;
 | 
					    launch_data_t listening_fd_array, listening_fd;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /* Get launchd fd */
 | 
					    /* Get launchd fd */
 | 
				
			||||||
    if ((checkin_request = launch_data_new_string(LAUNCH_KEY_CHECKIN)) == NULL) {
 | 
					    if ((checkin_request = launch_data_new_string(LAUNCH_KEY_CHECKIN)) == NULL) {
 | 
				
			||||||
        fprintf(stderr,"launch_data_new_string(\"" LAUNCH_KEY_CHECKIN "\") Unable to create string.\n");
 | 
					        asl_log(aslc, NULL, ASL_LEVEL_ERR, "launch_data_new_string(\"" LAUNCH_KEY_CHECKIN "\") Unable to create string.\n");
 | 
				
			||||||
        return ERROR_FD;
 | 
					        return ERROR_FD;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
    if ((checkin_response = launch_msg(checkin_request)) == NULL) {
 | 
					    if ((checkin_response = launch_msg(checkin_request)) == NULL) {
 | 
				
			||||||
        fprintf(stderr,"launch_msg(\"" LAUNCH_KEY_CHECKIN "\") IPC failure: %s\n",strerror(errno));
 | 
					        asl_log(aslc, NULL, ASL_LEVEL_WARNING, "launch_msg(\"" LAUNCH_KEY_CHECKIN "\") IPC failure: %s\n",strerror(errno));
 | 
				
			||||||
        return ERROR_FD;
 | 
					        return ERROR_FD;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
    if (LAUNCH_DATA_ERRNO == launch_data_get_type(checkin_response)) {
 | 
					    if (LAUNCH_DATA_ERRNO == launch_data_get_type(checkin_response)) {
 | 
				
			||||||
        // ignore EACCES, which is common if we weren't started by launchd
 | 
					        // ignore EACCES, which is common if we weren't started by launchd
 | 
				
			||||||
        if (launch_data_get_errno(checkin_response) != EACCES)
 | 
					        if (launch_data_get_errno(checkin_response) != EACCES)
 | 
				
			||||||
            fprintf(stderr,"launchd check-in failed: %s\n", strerror(launch_data_get_errno(checkin_response)));
 | 
					            asl_log(aslc, NULL, ASL_LEVEL_ERR, "launchd check-in failed: %s\n", strerror(launch_data_get_errno(checkin_response)));
 | 
				
			||||||
        return ERROR_FD;
 | 
					        return ERROR_FD;
 | 
				
			||||||
    } 
 | 
					    } 
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
    sockets_dict = launch_data_dict_lookup(checkin_response, LAUNCH_JOBKEY_SOCKETS);
 | 
					    sockets_dict = launch_data_dict_lookup(checkin_response, LAUNCH_JOBKEY_SOCKETS);
 | 
				
			||||||
    if (NULL == sockets_dict) {
 | 
					    if (NULL == sockets_dict) {
 | 
				
			||||||
        fprintf(stderr,"launchd check-in: no sockets found to answer requests on!\n");
 | 
					        asl_log(aslc, NULL, ASL_LEVEL_ERR, "launchd check-in: no sockets found to answer requests on!\n");
 | 
				
			||||||
        return ERROR_FD;
 | 
					        return ERROR_FD;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
    if (launch_data_dict_get_count(sockets_dict) > 1) {
 | 
					    if (launch_data_dict_get_count(sockets_dict) > 1) {
 | 
				
			||||||
        fprintf(stderr,"launchd check-in: some sockets will be ignored!\n");
 | 
					        asl_log(aslc, NULL, ASL_LEVEL_ERR, "launchd check-in: some sockets will be ignored!\n");
 | 
				
			||||||
        return ERROR_FD;
 | 
					        return ERROR_FD;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
| 
						 | 
					@ -73,13 +75,13 @@ int launchd_display_fd(void) {
 | 
				
			||||||
    if (NULL == listening_fd_array) {
 | 
					    if (NULL == listening_fd_array) {
 | 
				
			||||||
        listening_fd_array = launch_data_dict_lookup(sockets_dict, ":0");
 | 
					        listening_fd_array = launch_data_dict_lookup(sockets_dict, ":0");
 | 
				
			||||||
        if (NULL == listening_fd_array) {
 | 
					        if (NULL == listening_fd_array) {
 | 
				
			||||||
            fprintf(stderr,"launchd check-in: No known sockets found to answer requests on! \"%s:0\" and \":0\" failed.\n", BUNDLE_ID_PREFIX);
 | 
					            asl_log(aslc, NULL, ASL_LEVEL_ERR, "launchd check-in: No known sockets found to answer requests on! \"%s:0\" and \":0\" failed.\n", BUNDLE_ID_PREFIX);
 | 
				
			||||||
            return ERROR_FD;
 | 
					            return ERROR_FD;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
    if (launch_data_array_get_count(listening_fd_array)!=1) {
 | 
					    if (launch_data_array_get_count(listening_fd_array)!=1) {
 | 
				
			||||||
        fprintf(stderr,"launchd check-in: Expected 1 socket from launchd, got %u)\n",
 | 
					        asl_log(aslc, NULL, ASL_LEVEL_ERR, "launchd check-in: Expected 1 socket from launchd, got %u)\n",
 | 
				
			||||||
                (unsigned)launch_data_array_get_count(listening_fd_array));
 | 
					                (unsigned)launch_data_array_get_count(listening_fd_array));
 | 
				
			||||||
        return ERROR_FD;
 | 
					        return ERROR_FD;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -33,9 +33,9 @@
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include <string.h>
 | 
					#include <string.h>
 | 
				
			||||||
#include <stdio.h>
 | 
					 | 
				
			||||||
#include <unistd.h>
 | 
					#include <unistd.h>
 | 
				
			||||||
#include <errno.h>
 | 
					#include <errno.h>
 | 
				
			||||||
 | 
					#include <asl.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include <sys/socket.h>
 | 
					#include <sys/socket.h>
 | 
				
			||||||
#include <sys/un.h>
 | 
					#include <sys/un.h>
 | 
				
			||||||
| 
						 | 
					@ -43,8 +43,6 @@
 | 
				
			||||||
#define kX11AppBundleId BUNDLE_ID_PREFIX".X11"
 | 
					#define kX11AppBundleId BUNDLE_ID_PREFIX".X11"
 | 
				
			||||||
#define kX11AppBundlePath "/Contents/MacOS/X11"
 | 
					#define kX11AppBundlePath "/Contents/MacOS/X11"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static char *server_bootstrap_name = kX11AppBundleId;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#include <mach/mach.h>
 | 
					#include <mach/mach.h>
 | 
				
			||||||
#include <mach/mach_error.h>
 | 
					#include <mach/mach_error.h>
 | 
				
			||||||
#include <servers/bootstrap.h>
 | 
					#include <servers/bootstrap.h>
 | 
				
			||||||
| 
						 | 
					@ -57,8 +55,8 @@ static char *server_bootstrap_name = kX11AppBundleId;
 | 
				
			||||||
#include "launchd_fd.h"
 | 
					#include "launchd_fd.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static char x11_path[PATH_MAX + 1];
 | 
					static char x11_path[PATH_MAX + 1];
 | 
				
			||||||
 | 
					 | 
				
			||||||
static pid_t x11app_pid = 0;
 | 
					static pid_t x11app_pid = 0;
 | 
				
			||||||
 | 
					aslclient aslc;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void set_x11_path(void) {
 | 
					static void set_x11_path(void) {
 | 
				
			||||||
#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1050
 | 
					#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1050
 | 
				
			||||||
| 
						 | 
					@ -69,26 +67,24 @@ static void set_x11_path(void) {
 | 
				
			||||||
    switch (osstatus) {
 | 
					    switch (osstatus) {
 | 
				
			||||||
        case noErr:
 | 
					        case noErr:
 | 
				
			||||||
            if (appURL == NULL) {
 | 
					            if (appURL == NULL) {
 | 
				
			||||||
                fprintf(stderr, "Xquartz: Invalid response from LSFindApplicationForInfo(%s)\n", 
 | 
					                asl_log(aslc, NULL, ASL_LEVEL_ERR, "Xquartz: Invalid response from LSFindApplicationForInfo(%s)", 
 | 
				
			||||||
                        kX11AppBundleId);
 | 
					                        kX11AppBundleId);
 | 
				
			||||||
                exit(1);
 | 
					                exit(1);
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            if (!CFURLGetFileSystemRepresentation(appURL, true, (unsigned char *)x11_path, sizeof(x11_path))) {
 | 
					            if (!CFURLGetFileSystemRepresentation(appURL, true, (unsigned char *)x11_path, sizeof(x11_path))) {
 | 
				
			||||||
                fprintf(stderr, "Xquartz: Error resolving URL for %s\n", kX11AppBundleId);
 | 
					                asl_log(aslc, NULL, ASL_LEVEL_ERR, "Xquartz: Error resolving URL for %s", kX11AppBundleId);
 | 
				
			||||||
                exit(3);
 | 
					                exit(3);
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            strlcat(x11_path, kX11AppBundlePath, sizeof(x11_path));
 | 
					            strlcat(x11_path, kX11AppBundlePath, sizeof(x11_path));
 | 
				
			||||||
#ifdef DEBUG
 | 
					            asl_log(aslc, NULL, ASL_LEVEL_INFO, "Xquartz: X11.app = %s", x11_path);
 | 
				
			||||||
            fprintf(stderr, "Xquartz: X11.app = %s\n", x11_path);
 | 
					 | 
				
			||||||
#endif
 | 
					 | 
				
			||||||
            break;
 | 
					            break;
 | 
				
			||||||
        case kLSApplicationNotFoundErr:
 | 
					        case kLSApplicationNotFoundErr:
 | 
				
			||||||
            fprintf(stderr, "Xquartz: Unable to find application for %s\n", kX11AppBundleId);
 | 
					            asl_log(aslc, NULL, ASL_LEVEL_ERR, "Xquartz: Unable to find application for %s", kX11AppBundleId);
 | 
				
			||||||
            exit(10);
 | 
					            exit(10);
 | 
				
			||||||
        default:
 | 
					        default:
 | 
				
			||||||
            fprintf(stderr, "Xquartz: Unable to find application for %s, error code = %d\n", 
 | 
					            asl_log(aslc, NULL, ASL_LEVEL_ERR, "Xquartz: Unable to find application for %s, error code = %d", 
 | 
				
			||||||
                    kX11AppBundleId, (int)osstatus);
 | 
					                    kX11AppBundleId, (int)osstatus);
 | 
				
			||||||
            exit(11);
 | 
					            exit(11);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
| 
						 | 
					@ -114,12 +110,12 @@ static int connect_to_socket(const char *filename) {
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
    ret_fd = socket(PF_UNIX, SOCK_STREAM, 0);
 | 
					    ret_fd = socket(PF_UNIX, SOCK_STREAM, 0);
 | 
				
			||||||
    if(ret_fd == -1) {
 | 
					    if(ret_fd == -1) {
 | 
				
			||||||
        fprintf(stderr, "Xquartz: Failed to create socket: %s - %s\n", filename, strerror(errno));
 | 
					        asl_log(aslc, NULL, ASL_LEVEL_ERR, "Xquartz: Failed to create socket: %s - %s", filename, strerror(errno));
 | 
				
			||||||
        return -1;
 | 
					        return -1;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if(connect(ret_fd, servaddr, servaddr_len) < 0) {
 | 
					    if(connect(ret_fd, servaddr, servaddr_len) < 0) {
 | 
				
			||||||
        fprintf(stderr, "Xquartz: Failed to connect to socket: %s - %d - %s\n", filename, errno, strerror(errno));
 | 
					        asl_log(aslc, NULL, ASL_LEVEL_ERR, "Xquartz: Failed to connect to socket: %s - %d - %s", filename, errno, strerror(errno));
 | 
				
			||||||
        close(ret_fd);
 | 
					        close(ret_fd);
 | 
				
			||||||
        return -1;
 | 
					        return -1;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
| 
						 | 
					@ -160,14 +156,11 @@ static void send_fd_handoff(int connected_fd, int launchd_fd) {
 | 
				
			||||||
    *((int*)CMSG_DATA(cmsg)) = launchd_fd;
 | 
					    *((int*)CMSG_DATA(cmsg)) = launchd_fd;
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
    if(sendmsg(connected_fd, &msg, 0) < 0) {
 | 
					    if(sendmsg(connected_fd, &msg, 0) < 0) {
 | 
				
			||||||
        fprintf(stderr, "Xquartz: Error sending $DISPLAY file descriptor over fd %d: %d -- %s\n", connected_fd, errno, strerror(errno));
 | 
					        asl_log(aslc, NULL, ASL_LEVEL_ERR, "Xquartz: Error sending $DISPLAY file descriptor over fd %d: %d -- %s", connected_fd, errno, strerror(errno));
 | 
				
			||||||
        return;
 | 
					        return;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifdef DEBUG
 | 
					    asl_log(aslc, NULL, ASL_LEVEL_DEBUG, "Xquartz: Message sent.  Closing handoff fd.");
 | 
				
			||||||
    fprintf(stderr, "Xquartz: Message sent.  Closing handoff fd.\n");
 | 
					 | 
				
			||||||
#endif
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    close(connected_fd);
 | 
					    close(connected_fd);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -187,10 +180,25 @@ int main(int argc, char **argv, char **envp) {
 | 
				
			||||||
    int launchd_fd;
 | 
					    int launchd_fd;
 | 
				
			||||||
    string_t handoff_socket_filename;
 | 
					    string_t handoff_socket_filename;
 | 
				
			||||||
    sig_t handler;
 | 
					    sig_t handler;
 | 
				
			||||||
 | 
					    char *asl_sender;
 | 
				
			||||||
 | 
					    char *asl_facility;
 | 
				
			||||||
 | 
					    char *server_bootstrap_name = kX11AppBundleId;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if(getenv("X11_PREFS_DOMAIN"))
 | 
					    if(getenv("X11_PREFS_DOMAIN"))
 | 
				
			||||||
        server_bootstrap_name = getenv("X11_PREFS_DOMAIN");
 | 
					        server_bootstrap_name = getenv("X11_PREFS_DOMAIN");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    asprintf(&asl_sender, "%s.stub", server_bootstrap_name);
 | 
				
			||||||
 | 
					    assert(asl_sender);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    asl_facility = strdup(server_bootstrap_name);
 | 
				
			||||||
 | 
					    assert(asl_facility);
 | 
				
			||||||
 | 
					    if(strcmp(asl_facility + strlen(asl_facility) - 4, ".X11") == 0)
 | 
				
			||||||
 | 
					        asl_facility[strlen(asl_facility) - 4] = '\0';    
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    assert(aslc = asl_open(asl_sender, asl_facility, ASL_OPT_NO_DELAY));
 | 
				
			||||||
 | 
					    free(asl_sender);
 | 
				
			||||||
 | 
					    free(asl_facility);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /* We don't have a mechanism in place to handle this interrupt driven
 | 
					    /* We don't have a mechanism in place to handle this interrupt driven
 | 
				
			||||||
     * server-start notification, so just send the signal now, so xinit doesn't
 | 
					     * server-start notification, so just send the signal now, so xinit doesn't
 | 
				
			||||||
     * time out waiting for it and will just poll for the server.
 | 
					     * time out waiting for it and will just poll for the server.
 | 
				
			||||||
| 
						 | 
					@ -211,13 +219,13 @@ int main(int argc, char **argv, char **envp) {
 | 
				
			||||||
    if(kr != KERN_SUCCESS) {
 | 
					    if(kr != KERN_SUCCESS) {
 | 
				
			||||||
        pid_t child;
 | 
					        pid_t child;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        fprintf(stderr, "Xquartz: Unable to locate waiting server: %s\n", server_bootstrap_name);
 | 
					        asl_log(aslc, NULL, ASL_LEVEL_WARNING, "Xquartz: Unable to locate waiting server: %s", server_bootstrap_name);
 | 
				
			||||||
        set_x11_path();
 | 
					        set_x11_path();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        /* This forking is ugly and will be cleaned up later */
 | 
					        /* This forking is ugly and will be cleaned up later */
 | 
				
			||||||
        child = fork();
 | 
					        child = fork();
 | 
				
			||||||
        if(child == -1) {
 | 
					        if(child == -1) {
 | 
				
			||||||
            fprintf(stderr, "Xquartz: Could not fork: %s\n", strerror(errno));
 | 
					            asl_log(aslc, NULL, ASL_LEVEL_ERR, "Xquartz: Could not fork: %s", strerror(errno));
 | 
				
			||||||
            return EXIT_FAILURE;
 | 
					            return EXIT_FAILURE;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -226,7 +234,7 @@ int main(int argc, char **argv, char **envp) {
 | 
				
			||||||
            _argv[0] = x11_path;
 | 
					            _argv[0] = x11_path;
 | 
				
			||||||
            _argv[1] = "--listenonly";
 | 
					            _argv[1] = "--listenonly";
 | 
				
			||||||
            _argv[2] = NULL;
 | 
					            _argv[2] = NULL;
 | 
				
			||||||
            fprintf(stderr, "Xquartz: Starting X server: %s --listenonly\n", x11_path);
 | 
					            asl_log(aslc, NULL, ASL_LEVEL_NOTICE, "Xquartz: Starting X server: %s --listenonly", x11_path);
 | 
				
			||||||
            return execvp(x11_path, _argv);
 | 
					            return execvp(x11_path, _argv);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -240,9 +248,9 @@ int main(int argc, char **argv, char **envp) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if(kr != KERN_SUCCESS) {
 | 
					        if(kr != KERN_SUCCESS) {
 | 
				
			||||||
#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1050
 | 
					#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1050
 | 
				
			||||||
            fprintf(stderr, "Xquartz: bootstrap_look_up(): %s\n", bootstrap_strerror(kr));
 | 
					            asl_log(aslc, NULL, ASL_LEVEL_ERR, "Xquartz: bootstrap_look_up(): %s", bootstrap_strerror(kr));
 | 
				
			||||||
#else
 | 
					#else
 | 
				
			||||||
            fprintf(stderr, "Xquartz: bootstrap_look_up(): %ul\n", (unsigned long)kr);
 | 
					            asl_log(aslc, NULL, ASL_LEVEL_ERR, "Xquartz: bootstrap_look_up(): %ul", (unsigned long)kr);
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
            return EXIT_FAILURE;
 | 
					            return EXIT_FAILURE;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
| 
						 | 
					@ -258,20 +266,17 @@ int main(int argc, char **argv, char **envp) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        for(try=0, try_max=5; try < try_max; try++) {
 | 
					        for(try=0, try_max=5; try < try_max; try++) {
 | 
				
			||||||
            if(request_fd_handoff_socket(mp, handoff_socket_filename) != KERN_SUCCESS) {
 | 
					            if(request_fd_handoff_socket(mp, handoff_socket_filename) != KERN_SUCCESS) {
 | 
				
			||||||
                fprintf(stderr, "Xquartz: Failed to request a socket from the server to send the $DISPLAY fd over (try %d of %d)\n", (int)try+1, (int)try_max);
 | 
					                asl_log(aslc, NULL, ASL_LEVEL_INFO, "Xquartz: Failed to request a socket from the server to send the $DISPLAY fd over (try %d of %d)", (int)try+1, (int)try_max);
 | 
				
			||||||
                continue;
 | 
					                continue;
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            handoff_fd = connect_to_socket(handoff_socket_filename);
 | 
					            handoff_fd = connect_to_socket(handoff_socket_filename);
 | 
				
			||||||
            if(handoff_fd == -1) {
 | 
					            if(handoff_fd == -1) {
 | 
				
			||||||
                fprintf(stderr, "Xquartz: Failed to connect to socket (try %d of %d)\n", (int)try+1, (int)try_max);
 | 
					                asl_log(aslc, NULL, ASL_LEVEL_ERR, "Xquartz: Failed to connect to socket (try %d of %d)", (int)try+1, (int)try_max);
 | 
				
			||||||
                continue;
 | 
					                continue;
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifdef DEBUG
 | 
					            asl_log(aslc, NULL, ASL_LEVEL_INFO, "Xquartz: Handoff connection established (try %d of %d) on fd %d, \"%s\".  Sending message.", (int)try+1, (int)try_max, handoff_fd, handoff_socket_filename);
 | 
				
			||||||
            fprintf(stderr, "Xquartz: Handoff connection established (try %d of %d) on fd %d, \"%s\".  Sending message.\n", (int)try+1, (int)try_max, handoff_fd, handoff_socket_filename);
 | 
					 | 
				
			||||||
#endif
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            send_fd_handoff(handoff_fd, launchd_fd);            
 | 
					            send_fd_handoff(handoff_fd, launchd_fd);            
 | 
				
			||||||
            close(handoff_fd);
 | 
					            close(handoff_fd);
 | 
				
			||||||
            break;
 | 
					            break;
 | 
				
			||||||
| 
						 | 
					@ -288,7 +293,7 @@ int main(int argc, char **argv, char **envp) {
 | 
				
			||||||
    newenvp = (string_array_t)calloc((1 + envpc), sizeof(string_t));
 | 
					    newenvp = (string_array_t)calloc((1 + envpc), sizeof(string_t));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if(!newargv || !newenvp) {
 | 
					    if(!newargv || !newenvp) {
 | 
				
			||||||
        fprintf(stderr, "Xquartz: Memory allocation failure\n");
 | 
					        asl_log(aslc, NULL, ASL_LEVEL_ERR, "Xquartz: Memory allocation failure");
 | 
				
			||||||
        return EXIT_FAILURE;
 | 
					        return EXIT_FAILURE;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
| 
						 | 
					@ -305,7 +310,7 @@ int main(int argc, char **argv, char **envp) {
 | 
				
			||||||
    free(newenvp);
 | 
					    free(newenvp);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (kr != KERN_SUCCESS) {
 | 
					    if (kr != KERN_SUCCESS) {
 | 
				
			||||||
        fprintf(stderr, "Xquartz: start_x11_server: %s\n", mach_error_string(kr));
 | 
					        asl_log(aslc, NULL, ASL_LEVEL_ERR, "Xquartz: start_x11_server: %s", mach_error_string(kr));
 | 
				
			||||||
        return EXIT_FAILURE;
 | 
					        return EXIT_FAILURE;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    return EXIT_SUCCESS;
 | 
					    return EXIT_SUCCESS;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue