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.



git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@39689 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Marcus Müller 2016-04-23 15:44:31 +00:00
parent dbe7cef25d
commit cb3f465c10
2 changed files with 24 additions and 5 deletions

View file

@ -1,9 +1,15 @@
2016-05-08 Richard Frith-Macdonald <rfm@gnu.org>
2016-04-23 Marcus Mueller <znek@mulle-kybernetik.com>
* 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 <rfm@gnu.org>
* Source/NSUserDefaults.m
Remove redundant code. Log domain names when debug is enabled.
2016-05-08 Riccardo Mottola <rm@gnu.org>
2016-04-08 Riccardo Mottola <rm@gnu.org>
* Source/NSUserDefaults.m
Skip nil domains explicitely and do not use nil values to look them up.

View file

@ -881,7 +881,19 @@ didUpdateRecordData: (id)data
}
//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 @@ didUpdateRecordData: (id)data
{
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 @@ didUpdateRecordData: (id)data
_entryGroup = NULL;
}
if (0 != NSCountMapTable(_browsers))
if ((_browsers != NULL) && (0 != NSCountMapTable(_browsers)))
{
NSMapTable *enumerationTable;
NSMapEnumerator bEnum;