]> git.meshlink.io Git - catta/commitdiff
* Minor cleanups
authorLennart Poettering <lennart@poettering.net>
Sat, 15 Oct 2005 03:07:20 +0000 (03:07 +0000)
committerLennart Poettering <lennart@poettering.net>
Sat, 15 Oct 2005 03:07:20 +0000 (03:07 +0000)
* Really create a recursive mutex

git-svn-id: file:///home/lennart/svn/public/avahi/trunk@767 941a03a8-eaeb-0310-b9a0-b1bbd8fe43fe

avahi-compat-libdns_sd/compat.c

index a0b37969a922bc7f484d325ce31cd7bc111c491a..9b7ff8b3f7507df3863e2ca74b3af449fa08a9f0 100644 (file)
@@ -274,7 +274,7 @@ static DNSServiceRef sdref_new(void) {
 
     ASSERT_SUCCESS(pthread_mutexattr_init(&mutex_attr));
     pthread_mutexattr_settype(&mutex_attr, PTHREAD_MUTEX_RECURSIVE);
-    ASSERT_SUCCESS(pthread_mutex_init(&sdref->mutex, NULL));
+    ASSERT_SUCCESS(pthread_mutex_init(&sdref->mutex, &mutex_attr));
 
     sdref->thread_running = 0;
 
@@ -558,22 +558,22 @@ static void service_resolver_callback(
     void *userdata) {
 
     DNSServiceRef sdref = userdata;
-    char host_name_fixed[AVAHI_DOMAIN_NAME_MAX];
 
     assert(r);
     assert(sdref);
     assert(sdref->n_ref >= 1);
 
-    host_name = add_trailing_dot(host_name, host_name_fixed, sizeof(host_name_fixed));
-
     switch (event) {
         case AVAHI_RESOLVER_FOUND: {
 
+            char host_name_fixed[AVAHI_DOMAIN_NAME_MAX];
             char full_name[AVAHI_DOMAIN_NAME_MAX];
             int ret;
             char *p = NULL;
             size_t l = 0;
 
+            host_name = add_trailing_dot(host_name, host_name_fixed, sizeof(host_name_fixed));
+
             if ((p = avahi_new0(char, (l = avahi_string_list_serialize(txt, NULL, 0))+1)))
                 avahi_string_list_serialize(txt, p, l);
 
@@ -590,7 +590,7 @@ static void service_resolver_callback(
 
         case AVAHI_RESOLVER_FAILURE:
             sdref->service_resolver_callback(sdref, 0, interface, map_error(avahi_client_errno(sdref->client)), NULL, NULL, 0, 0, NULL, sdref->context);
-            
+            break;
     }
 }