Modified: trunk/launchd/src/launchd_core_logic.c (23241 => 23242)
--- trunk/launchd/src/launchd_core_logic.c 2007-04-27 20:29:41 UTC (rev 23241)
+++ trunk/launchd/src/launchd_core_logic.c 2007-05-07 21:15:05 UTC (rev 23242)
@@ -997,12 +997,8 @@
}
if (jobmgr_assumes(jm, (jr = job_new(jm, AUTO_PICK_LEGACY_LABEL, kp.kp_proc.p_comm, NULL)) != NULL)) {
- u_int proc_fflags = NOTE_EXEC|NOTE_EXIT;
+ u_int proc_fflags = NOTE_EXEC|NOTE_EXIT|NOTE_REAP;
-#ifdef NOTE_REAP
- proc_fflags |= NOTE_REAP;
-#endif
-
total_children++;
jr->anonymous = true;
jr->p = anonpid;
@@ -1983,22 +1979,22 @@
}
if (fflags & NOTE_EXIT) {
- job_assumes(j, (flags & EV_ONESHOT));
- job_assumes(j, (flags & EV_EOF));
job_reap(j);
if (j->anonymous) {
job_remove(j);
+ j = NULL;
} else {
j = job_dispatch(j, false);
}
}
-#ifdef NOTE_REAP
if (j && (fflags & NOTE_REAP)) {
+ job_assumes(j, flags & EV_ONESHOT);
+ job_assumes(j, flags & EV_EOF);
+
job_assumes(j, j->p == 0);
}
-#endif
}
void
@@ -2121,12 +2117,8 @@
pid_t c;
bool sipc = false;
time_t td;
- u_int proc_fflags = /* NOTE_EXEC|NOTE_FORK| */ NOTE_EXIT;
+ u_int proc_fflags = /* NOTE_EXEC|NOTE_FORK| */ NOTE_EXIT|NOTE_REAP;
-#ifdef NOTE_REAP
- proc_fflags |= NOTE_REAP;
-#endif
-
if (!job_assumes(j, j->mgr != NULL)) {
return;
}