summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeremy Huddleston <jeremyhu@apple.com>2011-04-25 22:26:02 -0700
committerJeremy Huddleston <jeremyhu@apple.com>2011-04-25 23:16:38 -0700
commitc6a7f895c8c90b85ed4fd08927c47b0d17ed067a (patch)
treef9b9a5d2b55728fbcca6dc72f02688761e57a593
parent567f59d3f8189b92bc46e2af1260f9340f462bdb (diff)
downloadxorg-app-xinit-c6a7f895c8c90b85ed4fd08927c47b0d17ed067a.tar.gz
launchd: Log messages to ASL rather than fprintf
Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
-rw-r--r--launchd/privileged_startx/Makefile.am3
-rw-r--r--launchd/privileged_startx/server.c16
-rw-r--r--launchd/user_startx/Makefile.am4
3 files changed, 14 insertions, 9 deletions
diff --git a/launchd/privileged_startx/Makefile.am b/launchd/privileged_startx/Makefile.am
index 92f2227..2cf4c82 100644
--- a/launchd/privileged_startx/Makefile.am
+++ b/launchd/privileged_startx/Makefile.am
@@ -67,7 +67,8 @@ launchdaemons_DATA = $(launchdaemons_PRE:plist.cpp=plist)
CLEANFILES = \
$(privstartx_SCRIPTS) \
$(BUILT_SOURCES) \
- $(launchdaemons_DATA)
+ $(launchdaemons_DATA) \
+ $(launchdidprefix).privileged_startx.plist.cpp
EXTRA_DIST = \
10-tmpdirs.cpp \
diff --git a/launchd/privileged_startx/server.c b/launchd/privileged_startx/server.c
index 4415943..dfe2c58 100644
--- a/launchd/privileged_startx/server.c
+++ b/launchd/privileged_startx/server.c
@@ -90,19 +90,19 @@ static mach_port_t checkin_or_register(char *bname) {
/* We probably were not started by launchd or the old mach_init */
kr = mach_port_allocate(mach_task_self(), MACH_PORT_RIGHT_RECEIVE, &mp);
if (kr != KERN_SUCCESS) {
- fprintf(stderr, "mach_port_allocate(): %s\n", mach_error_string(kr));
+ asl_log(NULL, NULL, ASL_LEVEL_ERR, "mach_port_allocate(): %s", mach_error_string(kr));
exit(EXIT_FAILURE);
}
kr = mach_port_insert_right(mach_task_self(), mp, mp, MACH_MSG_TYPE_MAKE_SEND);
if (kr != KERN_SUCCESS) {
- fprintf(stderr, "mach_port_insert_right(): %s\n", mach_error_string(kr));
+ asl_log(NULL, NULL, ASL_LEVEL_ERR, "mach_port_insert_right(): %s", mach_error_string(kr));
exit(EXIT_FAILURE);
}
kr = bootstrap_register(bootstrap_port, bname, mp);
if (kr != KERN_SUCCESS) {
- fprintf(stderr, "bootstrap_register(): %s\n", mach_error_string(kr));
+ asl_log(NULL, NULL, ASL_LEVEL_ERR, "bootstrap_register(): %s", mach_error_string(kr));
exit(EXIT_FAILURE);
}
@@ -188,7 +188,7 @@ int server_main(const char *dir) {
kr = mach_msg_server(privileged_startx_server, mxmsgsz, mp, 0);
if (kr != KERN_SUCCESS) {
asl_log(NULL, NULL, ASL_LEVEL_ERR,
- "mach_msg_server(mp): %s\n", mach_error_string(kr));
+ "mach_msg_server(mp): %s", mach_error_string(kr));
exit(EXIT_FAILURE);
}
@@ -218,7 +218,7 @@ kern_return_t do_privileged_startx(mach_port_t test_port __attribute__((unused))
ftsp = fts_open((char * const *)path_argv, FTS_PHYSICAL, ftscmp);
if(!ftsp) {
asl_log(NULL, NULL, ASL_LEVEL_ERR,
- "do_privileged_startx: fts_open(%s): %s\n",
+ "do_privileged_startx: fts_open(%s): %s",
script_dir, strerror(errno));
return KERN_FAILURE;
}
@@ -227,7 +227,7 @@ kern_return_t do_privileged_startx(mach_port_t test_port __attribute__((unused))
ftsent = fts_read(ftsp);
if(!ftsent) {
asl_log(NULL, NULL, ASL_LEVEL_ERR,
- "do_privileged_startx: fts_read(): %s\n", strerror(errno));
+ "do_privileged_startx: fts_read(): %s", strerror(errno));
fts_close(ftsp);
return KERN_FAILURE;
}
@@ -236,7 +236,7 @@ kern_return_t do_privileged_startx(mach_port_t test_port __attribute__((unused))
ftsent = fts_children(ftsp, 0);
if(!ftsent) {
asl_log(NULL, NULL, ASL_LEVEL_ERR,
- "do_privileged_startx: fts_children(): %s\n", strerror(errno));
+ "do_privileged_startx: fts_children(): %s", strerror(errno));
fts_close(ftsp);
return KERN_FAILURE;
}
@@ -260,7 +260,7 @@ kern_return_t do_privileged_startx(mach_port_t test_port __attribute__((unused))
error_code = system(fn_buf);
if(error_code != 0) {
asl_log(NULL, NULL, ASL_LEVEL_ERR,
- "do_privileged_startx: %s: exited with status %d\n",
+ "do_privileged_startx: %s: exited with status %d",
fn_buf, error_code);
retval = KERN_FAILURE;
}
diff --git a/launchd/user_startx/Makefile.am b/launchd/user_startx/Makefile.am
index 9e4e4d9..600d325 100644
--- a/launchd/user_startx/Makefile.am
+++ b/launchd/user_startx/Makefile.am
@@ -37,3 +37,7 @@ launchagents_PRE = $(launchdidprefix).startx.plist.cpp
launchagents_DATA = $(launchagents_PRE:plist.cpp=plist)
EXTRA_DIST = startx.plist.cpp
+
+CLEANFILES = \
+ $(launchagents_DATA) \
+ $(launchdidprefix).startx.plist.cpp