]> git.saurik.com Git - apple/xnu.git/blobdiff - osfmk/kern/ipc_sync.c
xnu-3248.40.184.tar.gz
[apple/xnu.git] / osfmk / kern / ipc_sync.c
index fdc418c1dac168c731706147d633dbe84a49bf82..941bd183973d72484486e64b0e166ea5330d5395 100644 (file)
@@ -75,9 +75,15 @@ port_name_to_semaphore(
        assert(IP_VALID(kern_port));
 
        *semaphorep = convert_port_to_semaphore(kern_port);
+       if (*semaphorep == SEMAPHORE_NULL) {
+               /* the port is valid, but doesn't denote a semaphore */
+               kr = KERN_INVALID_CAPABILITY;
+       } else {
+               kr = KERN_SUCCESS;
+       }
        ip_unlock(kern_port);
 
-       return KERN_SUCCESS;
+       return kr;
 }
 
 /*