Modified: trunk/launchd/src/launchd_core_logic.c (23468 => 23469)
--- trunk/launchd/src/launchd_core_logic.c 2007-12-19 17:33:08 UTC (rev 23468)
+++ trunk/launchd/src/launchd_core_logic.c 2007-12-19 17:40:56 UTC (rev 23469)
@@ -2084,8 +2084,12 @@
}
if (j->log_redirect_fd && !j->legacy_LS_job) {
- job_assumes(j, runtime_close(j->log_redirect_fd) != -1);
- j->log_redirect_fd = 0;
+ job_log_stdouterr(j); /* one last chance */
+
+ if (j->log_redirect_fd) {
+ job_assumes(j, runtime_close(j->log_redirect_fd) != -1);
+ j->log_redirect_fd = 0;
+ }
}
if (j->forkfd) {
Modified: trunk/launchd/src/launchd_runtime.c (23468 => 23469)
--- trunk/launchd/src/launchd_runtime.c 2007-12-19 17:33:08 UTC (rev 23468)
+++ trunk/launchd/src/launchd_runtime.c 2007-12-19 17:40:56 UTC (rev 23469)
@@ -1183,13 +1183,13 @@
}
if (!(LOG_MASK(attr->priority) & internal_mask_pri)) {
- goto out;
+ return;
}
if (getpid() != 1 || !shutdown_in_progress) {
vsnprintf(newmsg, sizeof(newmsg), message, args);
logmsg_add(attr, saved_errno, newmsg);
- goto out;
+ return;
}
if (shutdown_start.tv_sec == 0) {
@@ -1211,11 +1211,11 @@
pthread_mutex_unlock(&ourlock);
if (ourlogfile == NULL) {
- goto out;
+ return;
}
if (message == NULL) {
- goto out;
+ return;
}
timersub(&tvnow, &shutdown_start, &tvd_total);
@@ -1248,9 +1248,6 @@
strcpy(newmsg + j, "\n");
vfprintf(ourlogfile, newmsg, args);
-
-out:
- runtime_log_uncork_pending_drain();
}
bool
@@ -1375,6 +1372,7 @@
launchd_assumes(STAILQ_EMPTY(&logmsg_queue));
return;
} else if (getpid() == 1) {
+ runtime_log_uncork_pending_drain();
return;
}