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

source_changes at macosforge.org source_changes at macosforge.org
Tue Mar 31 17:24:58 PDT 2009


Revision: 23878
          http://trac.macosforge.org/projects/launchd/changeset/23878
Author:   dsorresso at apple.com
Date:     2009-03-31 17:24:58 -0700 (Tue, 31 Mar 2009)
Log Message:
-----------
<rdar://problem/6743959> launchd needs to reset one-shot environment variables right after fork(2), not during reap

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

Modified: trunk/launchd/src/launchd_core_logic.c
===================================================================
--- trunk/launchd/src/launchd_core_logic.c	2009-03-31 22:38:05 UTC (rev 23877)
+++ trunk/launchd/src/launchd_core_logic.c	2009-04-01 00:24:58 UTC (rev 23878)
@@ -2505,8 +2505,6 @@
 		job_mig_swap_integer(j, VPROC_GSK_WEIRD_BOOTSTRAP, 0, 0, &junk);
 	}
 
-	j->wait4debugger_oneshot = false;
-
 	if (j->log_redirect_fd && !j->legacy_LS_job) {
 		job_log_stdouterr(j); /* one last chance */
 
@@ -2650,14 +2648,7 @@
 			}
 		}
 	}
-	
-	struct envitem *ei = NULL, *et = NULL;
-	SLIST_FOREACH_SAFE( ei, &j->env, sle, et ) {
-		if( ei->one_shot ) {
-			SLIST_REMOVE(&j->env, ei, envitem, sle);
-		}
-	}
-	
+		
 	job_t ji = NULL;
 	while( (ji = LIST_FIRST(&j->suspended_perusers)) ) {
 		job_log(j, LOG_ERR, "Job exited before resuming per-user launchd for UID %u. Will forcibly resume.", ji->mach_uid);
@@ -3577,6 +3568,15 @@
 			job_reap(j);
 		}
 		
+		j->wait4debugger_oneshot = false;
+
+		struct envitem *ei = NULL, *et = NULL;
+		SLIST_FOREACH_SAFE( ei, &j->env, sle, et ) {
+			if( ei->one_shot ) {
+				SLIST_REMOVE(&j->env, ei, envitem, sle);
+			}
+		}
+		
 		if (likely(!j->stall_before_exec)) {
 			job_uncork_fork(j);
 		}
@@ -5818,11 +5818,6 @@
 		#if TARGET_OS_EMBEDDED
 			bootstrapper->stderrpath = strdup(_PATH_CONSOLE);
 		#endif
-		
-		#if 0
-			/* Start the update job. */
-			jobmgr_assumes(jm, kevent_mod((uintptr_t)do_sync, EVFILT_TIMER, EV_ADD, NOTE_SECONDS, 30, bootstrapper) != -1);
-		#endif
 			
 			jobmgr_assumes(jm, kevent_mod((uintptr_t)fileno(g_console), EVFILT_VNODE, EV_ADD | EV_ONESHOT, NOTE_REVOKE, 0, jm) != -1);
 		}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/launchd-changes/attachments/20090331/05749c93/attachment.html>


More information about the launchd-changes mailing list