[launchd-changes] [23055] trunk/launchd/src/launchd_core_logic.c

source_changes at macosforge.org source_changes at macosforge.org
Sat Feb 10 08:52:04 PST 2007


Revision: 23055
          http://trac.macosforge.org/projects/launchd/changeset/23055
Author:   zarzycki at apple.com
Date:     2007-02-10 08:52:04 -0800 (Sat, 10 Feb 2007)

Log Message:
-----------
Minor bug fixes.

Modified Paths:
--------------
    trunk/launchd/src/launchd_core_logic.c

Modified: trunk/launchd/src/launchd_core_logic.c
===================================================================
--- trunk/launchd/src/launchd_core_logic.c	2007-02-10 03:25:34 UTC (rev 23054)
+++ trunk/launchd/src/launchd_core_logic.c	2007-02-10 16:52:04 UTC (rev 23055)
@@ -3668,6 +3668,7 @@
 	char *contents = NULL;
 	int logfile_fd = -1;
 	int console_fd = -1;
+	int wstatus;
 	pid_t sp;
 
 	if (!debug_shutdown_hangs) {
@@ -3685,17 +3686,23 @@
 	 * We didn't give the 'sample' tool a bootstrap port, so it therefore
 	 * can't deadlock against launchd.
 	 */
-	if (job_assumes(j, (errno = posix_spawnp(&sp, sample_args[0], NULL, NULL, sample_args, environ)) == 0)) {
-		int wstatus;
+	if (!job_assumes(j, (errno = posix_spawnp(&sp, sample_args[0], NULL, NULL, sample_args, environ)) == 0)) {
+		goto out;
+	}
 
-		job_assumes(j, waitpid(sp, &wstatus, 0) != -1);
+	if (!job_assumes(j, waitpid(sp, &wstatus, 0) != -1)) {
+		goto out;
 	}
 
+	if (!job_assumes(j, WIFEXITED(wstatus) && WEXITSTATUS(wstatus) == 0)) {
+		goto out;
+	}
+
 	if (!job_assumes(j, (logfile_fd = open(logfile, O_RDONLY|O_NOCTTY)) != -1)) {
 		goto out;
 	}
 
-	if (!job_assumes(j, (console_fd = open(_PATH_CONSOLE, O_WRONLY|O_APPEND||O_NOCTTY)) != -1)) {
+	if (!job_assumes(j, (console_fd = open(_PATH_CONSOLE, O_WRONLY|O_APPEND|O_NOCTTY)) != -1)) {
 		goto out;
 	}
 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/launchd-changes/attachments/20070210/808780b6/attachment.html


More information about the launchd-changes mailing list