Author: mlytwyn
Date: Tue Feb  3 23:56:15 2015
New Revision: 38325

URL: http://svn.gna.org/viewcvs/gnustep?rev=38325&view=rev
Log:
Avahi crash fixes if daemon is not running

Modified:
    libs/base/branches/gnustep_testplant_branch/Source/GSAvahiClient.m
    
libs/base/branches/gnustep_testplant_branch/Source/GSAvahiNetServiceBrowser.m

Modified: libs/base/branches/gnustep_testplant_branch/Source/GSAvahiClient.m
URL: 
http://svn.gna.org/viewcvs/gnustep/libs/base/branches/gnustep_testplant_branch/Source/GSAvahiClient.m?rev=38325&r1=38324&r2=38325&view=diff
==============================================================================
--- libs/base/branches/gnustep_testplant_branch/Source/GSAvahiClient.m  
(original)
+++ libs/base/branches/gnustep_testplant_branch/Source/GSAvahiClient.m  Tue Feb 
 3 23:56:15 2015
@@ -147,10 +147,10 @@
     {
       [_lock lock];
       if (_client != NULL)
-       {
-         avahi_client_free((AvahiClient*)_client);
-         _client = NULL;
-       }
+        {
+          avahi_client_free((AvahiClient*)_client);
+          _client = NULL;
+        }
       [_lock unlock];
     }
 }
@@ -166,14 +166,19 @@
     {
       [_lock lock];
       if (_client == NULL)
-       {
-         _client = (void*)avahi_client_new([ctx avahiPoll],
-           (AvahiClientFlags)flags,
-           GSAvahiClientState,
-           (void*)self,
-           errNo);
-       }
+        {
+          _client = (void*)avahi_client_new([ctx avahiPoll],
+                                            (AvahiClientFlags)flags,
+                                            GSAvahiClientState,
+                                            (void*)self,
+                                            errNo);
+        }
       [_lock unlock];
+      
+      if ((_client == NULL) || (*errNo != 0))
+        {
+          NSWarnLog(@"client allocation error: %ld", *errNo);
+        }
     }
 }
 

Modified: 
libs/base/branches/gnustep_testplant_branch/Source/GSAvahiNetServiceBrowser.m
URL: 
http://svn.gna.org/viewcvs/gnustep/libs/base/branches/gnustep_testplant_branch/Source/GSAvahiNetServiceBrowser.m?rev=38325&r1=38324&r2=38325&view=diff
==============================================================================
--- 
libs/base/branches/gnustep_testplant_branch/Source/GSAvahiNetServiceBrowser.m   
    (original)
+++ 
libs/base/branches/gnustep_testplant_branch/Source/GSAvahiNetServiceBrowser.m   
    Tue Feb  3 23:56:15 2015
@@ -290,7 +290,11 @@
     {
       err = NSNetServicesActivityInProgress;
     }
-
+  else if (_client == NULL)
+    {
+      err = NSNetServicesInvalidError;
+    }
+  
   if (!err)
     {
       /* Check whether the avahi-client is in a working state (the caller


_______________________________________________
Gnustep-cvs mailing list
[email protected]
https://mail.gna.org/listinfo/gnustep-cvs

Reply via email to