[launchd-changes] [23866] trunk/launchd/src/launchd_core_logic.c
source_changes at macosforge.org
source_changes at macosforge.org
Tue Mar 24 13:59:08 PDT 2009
Revision: 23866
http://trac.macosforge.org/projects/launchd/changeset/23866
Author: dsorresso at apple.com
Date: 2009-03-24 13:59:07 -0700 (Tue, 24 Mar 2009)
Log Message:
-----------
<rdar://problem/6714910> launchd's logging about what look like a bugs in it.
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-24 17:52:00 UTC (rev 23865)
+++ trunk/launchd/src/launchd_core_logic.c 2009-03-24 20:59:07 UTC (rev 23866)
@@ -5559,7 +5559,7 @@
jobmgr_t r = jm;
if( jm->shutdown_phase > JOBMGR_PHASE_HOPEFULLY_EXITS_LAST && SLIST_EMPTY(&jm->submgrs) ) {
- jobmgr_log(jm, LOG_DEBUG | LOG_CONSOLE, "Removing.");
+ jobmgr_log(jm, LOG_DEBUG, "Removing.");
jobmgr_log_stray_children(jm, false);
jobmgr_remove(jm);
r = NULL;
@@ -7296,13 +7296,22 @@
char pu_db[PATH_MAX];
snprintf(pu_db, sizeof(pu_db), LAUNCHD_DB_PREFIX "/%s", lbuf);
- int err = -1;
- if( (err = stat(pu_db, &sb)) == -1 && job_assumes(ji, errno == ENOENT) ) {
+ bool created = false;
+ int err = stat(pu_db, &sb);
+ if( (err == -1 && errno == ENOENT) || (err == 0 && !S_ISDIR(sb.st_mode)) ) {
+ if( err == 0 ) {
+ char move_aside[PATH_MAX];
+ snprintf(move_aside, sizeof(move_aside), LAUNCHD_DB_PREFIX "/%s.movedaside", lbuf);
+
+ job_assumes(ji, rename(pu_db, move_aside) != -1);
+ }
+
job_assumes(ji, mkdir(pu_db, S_IRWXU) != -1);
- job_assumes(ji, (err = stat(pu_db, &sb)) != -1);
+ job_assumes(ji, chown(pu_db, which_user, 0) != -1);
+ created = true;
}
- if( err != -1 ) {
+ if( !created ) {
if( !job_assumes(ji, sb.st_uid == which_user) ) {
job_assumes(ji, chown(pu_db, which_user, 0) != -1);
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/launchd-changes/attachments/20090324/658789fa/attachment-0001.html>
More information about the launchd-changes
mailing list