Author: znek
Date: Sat Apr 23 17:44:31 2016
New Revision: 39689
URL: http://svn.gna.org/viewcvs/gnustep?rev=39689&view=rev
Log:
Avahi-based NSNetServices did crash upon publishing if Avahi daemon did not
run. Hardened code for this case which also works correctly if daemon is
started later on.
Modified:
libs/base/trunk/ChangeLog
libs/base/trunk/Source/GSAvahiNetService.m
Modified: libs/base/trunk/ChangeLog
URL:
http://svn.gna.org/viewcvs/gnustep/libs/base/trunk/ChangeLog?rev=39689&r1=39688&r2=39689&view=diff
==============================================================================
--- libs/base/trunk/ChangeLog (original)
+++ libs/base/trunk/ChangeLog Sat Apr 23 17:44:31 2016
@@ -1,9 +1,15 @@
-2016-05-08 Richard Frith-Macdonald <[email protected]>
+2016-04-23 Marcus Mueller <[email protected]>
+
+ * Source/GSAvahiNetService.m: Avahi-based NSNetServices did crash
+ upon publishing if Avahi daemon did not run. Hardened code for this
+ case which also works correctly if daemon is started later on.
+
+2016-04-08 Richard Frith-Macdonald <[email protected]>
* Source/NSUserDefaults.m
Remove redundant code. Log domain names when debug is enabled.
-2016-05-08 Riccardo Mottola <[email protected]>
+2016-04-08 Riccardo Mottola <[email protected]>
* Source/NSUserDefaults.m
Skip nil domains explicitely and do not use nil values to look them up.
Modified: libs/base/trunk/Source/GSAvahiNetService.m
URL:
http://svn.gna.org/viewcvs/gnustep/libs/base/trunk/Source/GSAvahiNetService.m?rev=39689&r1=39688&r2=39689&view=diff
==============================================================================
--- libs/base/trunk/Source/GSAvahiNetService.m (original)
+++ libs/base/trunk/Source/GSAvahiNetService.m Sat Apr 23 17:44:31 2016
@@ -881,7 +881,19 @@
}
//Create the entry group:
- _entryGroup = avahi_entry_group_new((AvahiClient*)_client,
GSAvahiEntryGroupStateChanged, (void*)self);
+ if (NULL != _client)
+ {
+ _entryGroup = avahi_entry_group_new((AvahiClient*)_client,
+ GSAvahiEntryGroupStateChanged,
+ (void*)self);
+ }
+ else
+ {
+ // having no _client usually means that avahi-daemon (or dbus)
+ // isn't running, unfortunately there's no precise errNo at this point
+ // so we're providing just our best guess
+ return AVAHI_ERR_NO_DAEMON;
+ }
// Handle error:
if (NULL == _entryGroup)
@@ -1074,7 +1086,8 @@
{
if (NO == [self addServiceRecordWithOptions: options])
{
- [self handleError: avahi_client_errno((AvahiClient*)_client)];
+ [self handleError: _client ?
avahi_client_errno((AvahiClient*)_client)
+ : AVAHI_ERR_NO_DAEMON];
}
}
[self commitEntryGroup];
@@ -1219,7 +1232,7 @@
_entryGroup = NULL;
}
- if (0 != NSCountMapTable(_browsers))
+ if ((_browsers != NULL) && (0 != NSCountMapTable(_browsers)))
{
NSMapTable *enumerationTable;
NSMapEnumerator bEnum;
_______________________________________________
Gnustep-cvs mailing list
[email protected]
https://mail.gna.org/listinfo/gnustep-cvs