growl agent should handle port busy
authorDerrick Brashear <shadow@dementia.org>
Wed, 24 Mar 2010 18:49:11 +0000 (14:49 -0400)
committerDerrick Brashear <shadow@dementia.org>
Wed, 24 Mar 2010 21:26:27 +0000 (14:26 -0700)
if the port can't be bound, die cleanly.
FIXES 126812

Change-Id: I6523f18c2b5f5bacfbd11d08736b9af14fa666e2
Reviewed-on: http://gerrit.openafs.org/1651
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>

src/platform/DARWIN/growlagent/main.m

index 1d256da..2982d02 100644 (file)
@@ -223,10 +223,16 @@ int main(int argc, const char **argv) {
        CFSocketContext MarinerSocketContext = {0, (void *)&growlContext, NULL, NULL, NULL };
        
        CFSocketRef MarinerSocket = CFSocketCreateWithSocketSignature(kCFAllocatorDefault, &MarinerSignature, kCFSocketReadCallBack, &MySocketReadCallBack, &MarinerSocketContext);
+
+       if (!MarinerSocket)
+               goto fail;
        
        CFSocketSetSocketFlags(MarinerSocket, kCFSocketCloseOnInvalidate|kCFSocketAutomaticallyReenableReadCallBack);
        
        CFRunLoopSourceRef MarinerRunLoopSource = CFSocketCreateRunLoopSource(NULL, MarinerSocket, 0);
+       if (!MarinerRunLoopSource)
+               goto fail;
+
        CFRunLoopAddSource(CFRunLoopGetCurrent(), MarinerRunLoopSource, kCFRunLoopCommonModes);
 
        /* Run the run loop until it is manually cancelled */
@@ -236,6 +242,7 @@ int main(int argc, const char **argv) {
        CFRelease(MarinerRunLoopSource);
        CFSocketInvalidate(MarinerSocket);
        CFRelease(MarinerSocket);
+fail:
        /* CFRelease(notificationInfo); */
        [pool release];