[launchd-changes] [23847] branches/PR-6564965/launchd/src/launchd_core_logic.c

source_changes at macosforge.org source_changes at macosforge.org
Thu Feb 26 19:38:46 PST 2009


Revision: 23847
          http://trac.macosforge.org/projects/launchd/changeset/23847
Author:   dsorresso at apple.com
Date:     2009-02-26 19:38:46 -0800 (Thu, 26 Feb 2009)
Log Message:
-----------
Creating per-user database directories.

Modified Paths:
--------------
    branches/PR-6564965/launchd/src/launchd_core_logic.c

Modified: branches/PR-6564965/launchd/src/launchd_core_logic.c
===================================================================
--- branches/PR-6564965/launchd/src/launchd_core_logic.c	2009-02-27 03:28:49 UTC (rev 23846)
+++ branches/PR-6564965/launchd/src/launchd_core_logic.c	2009-02-27 03:38:46 UTC (rev 23847)
@@ -7286,7 +7286,13 @@
 			char pu_db[PATH_MAX];
 			snprintf(pu_db, sizeof(pu_db), LAUNCHD_DB_PREFIX "/%s", lbuf);
 			
-			if( stat(pu_db, &sb) != -1 ) {
+			int err = -1;
+			if( (err = stat(pu_db, &sb)) == -1 && job_assumes(ji, errno == ENOENT) ) {
+				job_assumes(ji, mkdir(pu_db, S_IRWXU) != -1);
+				job_assumes(ji, (err = stat(pu_db, &sb)) != -1);
+			}
+			
+			if( err != -1 ) {
 				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/20090226/16071149/attachment.html>


More information about the launchd-changes mailing list