[launchd-changes] [23623] trunk/launchd/src/libbootstrap.c

source_changes at macosforge.org source_changes at macosforge.org
Fri May 9 13:05:28 PDT 2008


Revision: 23623
          http://trac.macosforge.org/projects/launchd/changeset/23623
Author:   zarzycki at apple.com
Date:     2008-05-09 13:05:28 -0700 (Fri, 09 May 2008)

Log Message:
-----------
<rdar://problem/5915392> Drag and drop no longer works from Finder to TextEdit - problem in bootstrap_look_up2?

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

Modified: trunk/launchd/src/libbootstrap.c
===================================================================
--- trunk/launchd/src/libbootstrap.c	2008-05-07 22:15:06 UTC (rev 23622)
+++ trunk/launchd/src/libbootstrap.c	2008-05-09 20:05:28 UTC (rev 23623)
@@ -173,11 +173,16 @@
 	static mach_port_t prev_bp;
 	static mach_port_t prev_sp;
 	static name_t prev_name;
+	bool per_pid_lookup = flags & BOOTSTRAP_PER_PID_SERVICE;
 	kern_return_t kr = 0;
 	mach_port_t puc;
 
 	pthread_mutex_lock(&bslu2_lock);
 
+	if (per_pid_lookup) {
+		goto skip_cache;
+	}
+
 	if (prev_sp) {
 	       	if ((bp == prev_bp) && (strncmp(prev_name, service_name, sizeof(name_t)) == 0)
 				&& (mach_port_mod_refs(mach_task_self(), prev_sp, MACH_PORT_RIGHT_SEND, 1) == 0)) {
@@ -189,6 +194,7 @@
 		}
 	}
 
+skip_cache:
 	if ((kr = vproc_mig_look_up2(bp, service_name, sp, target_pid, flags)) != VPROC_ERR_TRY_PER_USER) {
 		goto out;
 	}
@@ -201,7 +207,8 @@
 	mach_port_deallocate(mach_task_self(), puc);
 
 out:
-	if (kr == 0 && prev_sp == 0 && mach_port_mod_refs(mach_task_self(), *sp, MACH_PORT_RIGHT_SEND, 1) == 0) {
+	if (!per_pid_lookup && kr == 0 && prev_sp == 0
+			&& mach_port_mod_refs(mach_task_self(), *sp, MACH_PORT_RIGHT_SEND, 1) == 0) {
 		/* We're going to hold on to a send right as a MRU cache */
 		prev_bp = bp;
 		prev_sp = *sp;

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/launchd-changes/attachments/20080509/a28ec947/attachment.html


More information about the launchd-changes mailing list