]> git.meshlink.io Git - catta/blobdiff - avahi-compat-libdns_sd/compat.c
properly finish getopt argument table with a NULL entry (see #50)
[catta] / avahi-compat-libdns_sd / compat.c
index 052c8b2b8444858b6f7cea451819c095e63f524e..effa0e7adbdfbd6dd95176c2ac4af9a35049b7ff 100644 (file)
@@ -374,8 +374,8 @@ static void sdref_unref(DNSServiceRef sdref) {
 }
 
 int DNSSD_API DNSServiceRefSockFD(DNSServiceRef sdref) {
-    assert(sdref);
-    assert(sdref->n_ref >= 1);
+    if (!sdref || sdref->n_ref <= 0)
+        return -1;
 
     AVAHI_WARN_LINKAGE;