If the caller is a bundle, look up keys in its plist file to get the name
authorAlexandra Ellwood <lxs@mit.edu>
Tue, 7 Oct 2008 19:23:10 +0000 (19:23 +0000)
committerAlexandra Ellwood <lxs@mit.edu>
Tue, 7 Oct 2008 19:23:10 +0000 (19:23 +0000)
ticket: 6146

git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@20836 dc483132-0cff-0310-8789-dd5450dbe970

src/kim/lib/mac/kim_os_library.c

index b0781bbf219db05cb9cdde8fc5f79be1f0959e78..63edfde327749eac347084d9efefa3b89c19872a 100644 (file)
@@ -233,14 +233,17 @@ kim_error kim_os_library_get_caller_name (kim_string *out_application_name)
     if (!err && !out_application_name) { err = check_error (KIM_NULL_PARAMETER_ERR); }
     
     if (!err && bundle) {
-        CFURLRef bundle_url = CFBundleCopyBundleURL (bundle);
+        cfname = CFBundleGetValueForInfoDictionaryKey (bundle, 
+                                                       kCFBundleNameKey);
         
-        if (bundle_url) {
-            err = LSCopyDisplayNameForURL (bundle_url, &cfname);
-            check_error (err);
+        if (!cfname || CFGetTypeID (cfname) != CFStringGetTypeID ()) {
+            cfname = CFBundleGetValueForInfoDictionaryKey (bundle, 
+                                                           kCFBundleExecutableKey);
         }
         
-        if (bundle_url) { CFRelease (bundle_url); }
+        if (cfname) {
+            cfname = CFStringCreateCopy (kCFAllocatorDefault, cfname);
+        }
     }
     
     if (!err && !cfname) {