X-Git-Url: http://git.meshlink.io/?a=blobdiff_plain;f=avahi-core%2Favahi-test.c;h=0d47941b802901ba29625349bdb25dc106e9afbc;hb=219241ab5223b705ade51485ea9227b0a6089c0d;hp=5f4b91e674d1e78815d626e3080c2afbf4771aa4;hpb=c0244c2448a5504581ae24e78b5859760b999b8e;p=catta diff --git a/avahi-core/avahi-test.c b/avahi-core/avahi-test.c index 5f4b91e..0d47941 100644 --- a/avahi-core/avahi-test.c +++ b/avahi-core/avahi-test.c @@ -114,12 +114,29 @@ static void create_entries(gboolean new_name) { service_name = n; } - avahi_server_add_service(server, group, 0, AF_UNSPEC, "_http._tcp", service_name, NULL, NULL, 80, "foo", NULL); - avahi_server_add_service(server, group, 0, AF_UNSPEC, "_ftp._tcp", service_name, NULL, NULL, 21, "foo", NULL); - avahi_server_add_service(server, group, 0, AF_UNSPEC, "_webdav._tcp", service_name, NULL, NULL, 80, "foo", NULL); + if (avahi_server_add_service(server, group, 0, AF_UNSPEC, "_http._tcp", service_name, NULL, NULL, 80, "foo", NULL) < 0) { + avahi_log_error("Failed to add HTTP service"); + goto fail; + } + + if (avahi_server_add_service(server, group, 0, AF_UNSPEC, "_ftp._tcp", service_name, NULL, NULL, 21, "foo", NULL) < 0) { + avahi_log_error("Failed to add FTP service"); + goto fail; + } + + if (avahi_server_add_service(server, group, 0, AF_UNSPEC, "_webdav._tcp", service_name, NULL, NULL, 80, "foo", NULL) < 0) { + avahi_log_error("Failed to add WEBDAV service"); + goto fail; + } - avahi_entry_group_commit(group); + avahi_entry_group_commit(group); + return; +fail: + if (group) + avahi_entry_group_free(group); + + group = NULL; } static void hnr_callback(AvahiHostNameResolver *r, gint iface, guchar protocol, AvahiBrowserEvent event, const gchar *hostname, const AvahiAddress *a, gpointer userdata) {