diff --git a/ChangeLog b/ChangeLog index 518f1bd6..2d15b35e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,16 @@ +2013.10.19, Version 0.10.18 (Stable), 9ec52963b585e822e87bdc5de28d6143aff0d2e5 + +Changes since version 0.10.17: + +* unix: fix uv_spawn() NULL pointer deref on ENOMEM (Ben Noordhuis) + +* unix: don't close inherited fds on uv_spawn() fail (Ben Noordhuis) + +* unix: revert recent FSEvent changes (Ben Noordhuis) + +* unix: fix non-synchronized access in signal.c (Ben Noordhuis) + + 2013.09.25, Version 0.10.17 (Stable), 9670e0a93540c2f0d86c84a375f2303383c11e7e Changes since version 0.10.16: diff --git a/src/unix/darwin-proctitle.c b/src/unix/darwin-proctitle.c index c5f53a08..8cd358bc 100644 --- a/src/unix/darwin-proctitle.c +++ b/src/unix/darwin-proctitle.c @@ -61,7 +61,6 @@ int uv__set_process_title(const char* title) { CFBundleRef (*pCFBundleGetBundleWithIdentifier)(CFStringRef); void *(*pCFBundleGetDataPointerForName)(CFBundleRef, CFStringRef); void *(*pCFBundleGetFunctionPointerForName)(CFBundleRef, CFStringRef); - OSErr (*pGetCurrentProcess)(ProcessSerialNumber*); CFTypeRef (*pLSGetCurrentApplicationASN)(void); OSStatus (*pLSSetApplicationInformationItem)(int, CFTypeRef, @@ -72,7 +71,13 @@ int uv__set_process_title(const char* title) { void* core_foundation_handle; CFBundleRef launch_services_bundle; CFStringRef* display_name_key; - ProcessSerialNumber psn; + CFDictionaryRef (*pCFBundleGetInfoDictionary)(CFBundleRef); + CFBundleRef (*pCFBundleGetMainBundle)(void); + CFBundleRef hi_services_bundle; + OSStatus (*pSetApplicationIsDaemon)(int); + CFDictionaryRef (*pLSApplicationCheckIn)(int, CFDictionaryRef); + void (*pLSSetApplicationLaunchServicesServerConnectionStatus)(uint64_t, + void*); CFTypeRef asn; int err; @@ -89,8 +94,6 @@ int uv__set_process_title(const char* title) { if (application_services_handle == NULL || core_foundation_handle == NULL) goto out; - pGetCurrentProcess = - dlsym(application_services_handle, "GetCurrentProcess"); pCFStringCreateWithCString = dlsym(core_foundation_handle, "CFStringCreateWithCString"); pCFBundleGetBundleWithIdentifier = @@ -100,8 +103,7 @@ int uv__set_process_title(const char* title) { pCFBundleGetFunctionPointerForName = dlsym(core_foundation_handle, "CFBundleGetFunctionPointerForName"); - if (pGetCurrentProcess == NULL || - pCFStringCreateWithCString == NULL || + if (pCFStringCreateWithCString == NULL || pCFBundleGetBundleWithIdentifier == NULL || pCFBundleGetDataPointerForName == NULL || pCFBundleGetFunctionPointerForName == NULL) { @@ -136,8 +138,44 @@ int uv__set_process_title(const char* title) { if (display_name_key == NULL || *display_name_key == NULL) goto out; - /* Force the process manager to initialize. */ - pGetCurrentProcess(&psn); + pCFBundleGetInfoDictionary = dlsym(core_foundation_handle, + "CFBundleGetInfoDictionary"); + pCFBundleGetMainBundle = dlsym(core_foundation_handle, + "CFBundleGetMainBundle"); + if (pCFBundleGetInfoDictionary == NULL || pCFBundleGetMainBundle == NULL) + goto out; + + /* Black 10.9 magic, to remove (Not responding) mark in Activity Monitor */ + hi_services_bundle = + pCFBundleGetBundleWithIdentifier(S("com.apple.HIServices")); + err = -ENOENT; + if (hi_services_bundle == NULL) + goto out; + + pSetApplicationIsDaemon = pCFBundleGetFunctionPointerForName( + hi_services_bundle, + S("SetApplicationIsDaemon")); + pLSApplicationCheckIn = pCFBundleGetFunctionPointerForName( + launch_services_bundle, + S("_LSApplicationCheckIn")); + pLSSetApplicationLaunchServicesServerConnectionStatus = + pCFBundleGetFunctionPointerForName( + launch_services_bundle, + S("_LSSetApplicationLaunchServicesServerConnectionStatus")); + if (pSetApplicationIsDaemon == NULL || + pLSApplicationCheckIn == NULL || + pLSSetApplicationLaunchServicesServerConnectionStatus == NULL) { + goto out; + } + + if (pSetApplicationIsDaemon(1) != noErr) + goto out; + + pLSSetApplicationLaunchServicesServerConnectionStatus(0, NULL); + + /* Check into process manager?! */ + pLSApplicationCheckIn(-2, + pCFBundleGetInfoDictionary(pCFBundleGetMainBundle())); asn = pLSGetCurrentApplicationASN();