From 4cd122efcfa47afbe8c2ebeee6d8fd48914839a7 Mon Sep 17 00:00:00 2001
From: Jeremy Huddleston <jeremyhu@apple.com>
Date: Wed, 18 Apr 2012 09:47:33 -0700
Subject: [PATCH 3/5] launchd: Provide more verbose error reporting for
 launchd checkin failures

Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
---
 launchd/privileged_startx/server.c |   14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git xinit-1.3.2/launchd/privileged_startx/server.c xinit-1.3.2/launchd/privileged_startx/server.c
index cfbb623..a93cae3 100644
--- xinit-1.3.2/launchd/privileged_startx/server.c
+++ xinit-1.3.2/launchd/privileged_startx/server.c
@@ -125,9 +125,19 @@ int server_main(const char *dir) {
     aslclient aslc;
 
     checkin = launch_data_new_string(LAUNCH_KEY_CHECKIN);
+    if (!checkin) {
+        asl_log(NULL, NULL, ASL_LEVEL_ERR, "unable to create launchd checkin string");
+        exit(EXIT_FAILURE);
+    }
+
     config = launch_msg(checkin);
-    if (!config || launch_data_get_type(config) == LAUNCH_DATA_ERRNO) {
-        asl_log(NULL, NULL, ASL_LEVEL_ERR, "launchd checkin failed");
+    if (!config) {
+        asl_log(NULL, NULL, ASL_LEVEL_ERR, "could not send a message to launchd");
+        exit(EXIT_FAILURE);
+    }
+
+    if (launch_data_get_type(config) == LAUNCH_DATA_ERRNO) {
+        asl_log(NULL, NULL, ASL_LEVEL_ERR, "launchd checkin failed eith error: %d %s", launch_data_get_errno(config), strerror(launch_data_get_errno(config)));
         exit(EXIT_FAILURE);
     }
 
-- 
1.7.10

