]> git.meshlink.io Git - catta/blobdiff - avahi-core/avahi-test.c
Sending translation for Hungarian
[catta] / avahi-core / avahi-test.c
index 9123bfeed9eefc8beb65a361b8bdb9e6a2a84bbb..cb7b97e1ad91527f932a41c166fb42606e73eb48 100644 (file)
 #include <config.h>
 #endif
 
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <arpa/inet.h>
 #include <stdlib.h>
 #include <stdio.h>
 #include <assert.h>
 
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <netinet/in.h>
+#include <arpa/inet.h>
+
 #include <avahi-common/malloc.h>
 #include <avahi-common/simple-watch.h>
 #include <avahi-common/alternative.h>
@@ -190,9 +192,11 @@ static void create_entries(int new_name) {
     r->data.cname.name = avahi_strdup("cocaine.local");
     
     if (avahi_server_add(server, group, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC, 0, r) < 0) {
+        avahi_record_unref(r);
         avahi_log_error("Failed to add CNAME record");
         goto fail;
     }
+    avahi_record_unref(r);
 
     avahi_s_entry_group_commit(group);
     return;
@@ -246,7 +250,7 @@ static void db_callback(
     AVAHI_GCC_UNUSED AvahiLookupResultFlags flags,
     AVAHI_GCC_UNUSED void* userdata) {
 
-    avahi_log_debug("DB: (%i.%i) <%s> [%s]", iface, protocol, domain, browser_event_to_string(event));
+    avahi_log_debug("DB: (%i.%i) <%s> [%s]", iface, protocol, domain ? domain : "NULL", browser_event_to_string(event));
 }
 
 static void stb_callback(
@@ -259,7 +263,7 @@ static void stb_callback(
     AVAHI_GCC_UNUSED AvahiLookupResultFlags flags,
     AVAHI_GCC_UNUSED void* userdata) {
 
-    avahi_log_debug("STB: (%i.%i) %s in <%s> [%s]", iface, protocol, service_type, domain, browser_event_to_string(event));
+    avahi_log_debug("STB: (%i.%i) %s in <%s> [%s]", iface, protocol, service_type ? service_type : "NULL", domain ? domain : "NULL", browser_event_to_string(event));
 }
 
 static void sb_callback(
@@ -272,7 +276,7 @@ static void sb_callback(
     const char *domain,
     AVAHI_GCC_UNUSED AvahiLookupResultFlags flags,
     AVAHI_GCC_UNUSED void* userdata) {
-    avahi_log_debug("SB: (%i.%i) <%s> as %s in <%s> [%s]", iface, protocol, name, service_type, domain, browser_event_to_string(event));
+    avahi_log_debug("SB: (%i.%i) <%s> as %s in <%s> [%s]", iface, protocol, name ? name : "NULL", service_type ? service_type : "NULL", domain ? domain : "NULL", browser_event_to_string(event));
 }
 
 static void sr_callback(
@@ -319,7 +323,7 @@ static void dsb_callback(
     if (a)
         avahi_address_snprint(t, sizeof(t), a);
 
-    avahi_log_debug("DSB: (%i.%i): %s/%s:%i [%s]", iface, protocol, hostname, t, port, browser_event_to_string(event));
+    avahi_log_debug("DSB: (%i.%i): %s/%s:%i [%s]", iface, protocol, hostname ? hostname : "NULL", t, port, browser_event_to_string(event));
 }
 
 int main(AVAHI_GCC_UNUSED int argc, AVAHI_GCC_UNUSED char *argv[]) {