]> git.meshlink.io Git - catta/commitdiff
work around a limitation in Gentoo's DBUS build (which is compiled with --disable...
authorLennart Poettering <lennart@poettering.net>
Sat, 15 Jul 2006 20:15:30 +0000 (20:15 +0000)
committerLennart Poettering <lennart@poettering.net>
Sat, 15 Jul 2006 20:15:30 +0000 (20:15 +0000)
git-svn-id: file:///home/lennart/svn/public/avahi/trunk@1235 941a03a8-eaeb-0310-b9a0-b1bbd8fe43fe

avahi-daemon/dbus-async-address-resolver.c
avahi-daemon/dbus-async-host-name-resolver.c
avahi-daemon/dbus-async-service-resolver.c
avahi-daemon/dbus-domain-browser.c
avahi-daemon/dbus-entry-group.c
avahi-daemon/dbus-protocol.c
avahi-daemon/dbus-record-browser.c
avahi-daemon/dbus-service-browser.c
avahi-daemon/dbus-service-type-browser.c

index f51d205e821103b1aaaf7240be3a7e27cd22c447..f05af8fdb950c4e6e69032ffedac902a4bbd3d90 100644 (file)
@@ -38,7 +38,12 @@ void avahi_dbus_async_address_resolver_free(AsyncAddressResolverInfo *i) {
 
     if (i->address_resolver)
         avahi_s_address_resolver_free(i->address_resolver);
-    dbus_connection_unregister_object_path(server->bus, i->path);
+
+    if (i->path) {
+        dbus_connection_unregister_object_path(server->bus, i->path);
+        avahi_free(i->path);
+    }
+    
     AVAHI_LLIST_REMOVE(AsyncAddressResolverInfo, async_address_resolvers, i->client->async_address_resolvers, i);
 
     i->client->n_objects--;
index 38b5c2a57a94c4694a53a5916e50e0a83c5692b5..a2c99a7f9d845d25734801382bdcfa6a17d40506 100644 (file)
@@ -38,7 +38,11 @@ void avahi_dbus_async_host_name_resolver_free(AsyncHostNameResolverInfo *i) {
 
     if (i->host_name_resolver)
         avahi_s_host_name_resolver_free(i->host_name_resolver);
-    dbus_connection_unregister_object_path(server->bus, i->path);
+
+    if (i->path) {
+        dbus_connection_unregister_object_path(server->bus, i->path);
+        avahi_free(i->path);
+    }
     AVAHI_LLIST_REMOVE(AsyncHostNameResolverInfo, async_host_name_resolvers, i->client->async_host_name_resolvers, i);
 
     i->client->n_objects--;
index 9fea5a112603022eea5530bd64c1f546bbf393d9..a9a13644977e8a754d509e7364305d737c96333f 100644 (file)
@@ -39,7 +39,11 @@ void avahi_dbus_async_service_resolver_free(AsyncServiceResolverInfo *i) {
     if (i->service_resolver)
         avahi_s_service_resolver_free(i->service_resolver);
 
-    dbus_connection_unregister_object_path(server->bus, i->path);
+    if (i->path) {
+        dbus_connection_unregister_object_path(server->bus, i->path);
+        avahi_free(i->path);
+    }
+    
     AVAHI_LLIST_REMOVE(AsyncServiceResolverInfo, async_service_resolvers, i->client->async_service_resolvers, i);
 
     i->client->n_objects--;
index a17de8f2ce3c84c9e0539d6cd234205c3977e969..b529ede450a8daae1ac590d0a501385d5a11b1ff 100644 (file)
@@ -38,8 +38,12 @@ void avahi_dbus_domain_browser_free(DomainBrowserInfo *i) {
 
     if (i->domain_browser)
         avahi_s_domain_browser_free(i->domain_browser);
-    dbus_connection_unregister_object_path(server->bus, i->path);
-    avahi_free(i->path);
+
+    if (i->path) {
+        dbus_connection_unregister_object_path(server->bus, i->path);
+        avahi_free(i->path);
+    }
+    
     AVAHI_LLIST_REMOVE(DomainBrowserInfo, domain_browsers, i->client->domain_browsers, i);
 
     i->client->n_objects--;
index 1d8c957a79e1f490bf3b2ed465cab4c8e0b8707e..0e1a21cba6095bb50c4a4288bfd9e1d781c86dfa 100644 (file)
@@ -40,8 +40,11 @@ void avahi_dbus_entry_group_free(EntryGroupInfo *i) {
 
     if (i->entry_group)
         avahi_s_entry_group_free(i->entry_group);
-    dbus_connection_unregister_object_path(server->bus, i->path);
-    avahi_free(i->path);
+
+    if (i->path) {
+        dbus_connection_unregister_object_path(server->bus, i->path);
+        avahi_free(i->path);
+    }
     AVAHI_LLIST_REMOVE(EntryGroupInfo, entry_groups, i->client->entry_groups, i);
 
     i->client->n_objects--;
index 5b9bc503a8ff32c2458c327945aaa99ce21e3ec1..19e956b6c214145900abf78a759c6885efe619ab 100644 (file)
@@ -456,7 +456,7 @@ static DBusHandlerResult msg_server_impl(DBusConnection *c, DBusMessage *m, AVAH
         i = avahi_new(EntryGroupInfo, 1);
         i->id = ++client->current_id;
         i->client = client;
-        i->path = avahi_strdup_printf("/Client%u/EntryGroup%u", client->id, i->id);
+        i->path = NULL;
         i->n_entries = 0;
         AVAHI_LLIST_PREPEND(EntryGroupInfo, entry_groups, client->entry_groups, i);
         client->n_objects++;
@@ -466,6 +466,7 @@ static DBusHandlerResult msg_server_impl(DBusConnection *c, DBusMessage *m, AVAH
             return avahi_dbus_respond_error(c, m, avahi_server_errno(avahi_server), NULL);
         }
 
+        i->path = avahi_strdup_printf("/Client%u/EntryGroup%u", client->id, i->id);
         dbus_connection_register_object_path(c, i->path, &vtable, i);
         return avahi_dbus_respond_path(c, m, i->path);
         
@@ -599,7 +600,7 @@ static DBusHandlerResult msg_server_impl(DBusConnection *c, DBusMessage *m, AVAH
         i = avahi_new(DomainBrowserInfo, 1);
         i->id = ++client->current_id;
         i->client = client;
-        i->path = avahi_strdup_printf("/Client%u/DomainBrowser%u", client->id, i->id);
+        i->path = NULL;
         AVAHI_LLIST_PREPEND(DomainBrowserInfo, domain_browsers, client->domain_browsers, i);
         client->n_objects++;
 
@@ -607,7 +608,8 @@ static DBusHandlerResult msg_server_impl(DBusConnection *c, DBusMessage *m, AVAH
             avahi_dbus_domain_browser_free(i);
             return avahi_dbus_respond_error(c, m, avahi_server_errno(avahi_server), NULL);
         }
-        
+
+        i->path = avahi_strdup_printf("/Client%u/DomainBrowser%u", client->id, i->id);
         dbus_connection_register_object_path(c, i->path, &vtable, i);
         return avahi_dbus_respond_path(c, m, i->path);
 
@@ -653,7 +655,7 @@ static DBusHandlerResult msg_server_impl(DBusConnection *c, DBusMessage *m, AVAH
         i = avahi_new(ServiceTypeBrowserInfo, 1);
         i->id = ++client->current_id;
         i->client = client;
-        i->path = avahi_strdup_printf("/Client%u/ServiceTypeBrowser%u", client->id, i->id);
+        i->path = NULL;
         AVAHI_LLIST_PREPEND(ServiceTypeBrowserInfo, service_type_browsers, client->service_type_browsers, i);
         client->n_objects++;
 
@@ -662,6 +664,7 @@ static DBusHandlerResult msg_server_impl(DBusConnection *c, DBusMessage *m, AVAH
             return avahi_dbus_respond_error(c, m, avahi_server_errno(avahi_server), NULL);
         }
         
+        i->path = avahi_strdup_printf("/Client%u/ServiceTypeBrowser%u", client->id, i->id);
         dbus_connection_register_object_path(c, i->path, &vtable, i);
         return avahi_dbus_respond_path(c, m, i->path);
         
@@ -708,7 +711,7 @@ static DBusHandlerResult msg_server_impl(DBusConnection *c, DBusMessage *m, AVAH
         i = avahi_new(ServiceBrowserInfo, 1);
         i->id = ++client->current_id;
         i->client = client;
-        i->path = avahi_strdup_printf("/Client%u/ServiceBrowser%u", client->id, i->id);
+        i->path = NULL;
         AVAHI_LLIST_PREPEND(ServiceBrowserInfo, service_browsers, client->service_browsers, i);
         client->n_objects++;
 
@@ -716,7 +719,8 @@ static DBusHandlerResult msg_server_impl(DBusConnection *c, DBusMessage *m, AVAH
             avahi_dbus_service_browser_free(i);
             return avahi_dbus_respond_error(c, m, avahi_server_errno(avahi_server), NULL);
         }
-        
+
+        i->path = avahi_strdup_printf("/Client%u/ServiceBrowser%u", client->id, i->id);
         dbus_connection_register_object_path(c, i->path, &vtable, i);
         return avahi_dbus_respond_path(c, m, i->path);
         
@@ -818,7 +822,7 @@ static DBusHandlerResult msg_server_impl(DBusConnection *c, DBusMessage *m, AVAH
         i = avahi_new(AsyncServiceResolverInfo, 1);
         i->id = ++client->current_id;
         i->client = client;
-        i->path = avahi_strdup_printf("/Client%u/ServiceResolver%u", client->id, i->id);
+        i->path = NULL;
         AVAHI_LLIST_PREPEND(AsyncServiceResolverInfo, async_service_resolvers, client->async_service_resolvers, i);
         client->n_objects++;
 
@@ -829,6 +833,7 @@ static DBusHandlerResult msg_server_impl(DBusConnection *c, DBusMessage *m, AVAH
 
 /*         avahi_log_debug(__FILE__": [%s], new service resolver for <%s.%s.%s>", i->path, name, type, domain); */
         
+        i->path = avahi_strdup_printf("/Client%u/ServiceResolver%u", client->id, i->id);
         dbus_connection_register_object_path(c, i->path, &vtable, i);
         return avahi_dbus_respond_path(c, m, i->path);
 
@@ -872,7 +877,7 @@ static DBusHandlerResult msg_server_impl(DBusConnection *c, DBusMessage *m, AVAH
         i = avahi_new(AsyncHostNameResolverInfo, 1);
         i->id = ++client->current_id;
         i->client = client;
-        i->path = avahi_strdup_printf("/Client%u/HostNameResolver%u", client->id, i->id);
+        i->path = NULL;
         AVAHI_LLIST_PREPEND(AsyncHostNameResolverInfo, async_host_name_resolvers, client->async_host_name_resolvers, i);
         client->n_objects++;
 
@@ -880,7 +885,8 @@ static DBusHandlerResult msg_server_impl(DBusConnection *c, DBusMessage *m, AVAH
             avahi_dbus_async_host_name_resolver_free(i);
             return avahi_dbus_respond_error(c, m, avahi_server_errno(avahi_server), NULL);
         }
-        
+
+        i->path = avahi_strdup_printf("/Client%u/HostNameResolver%u", client->id, i->id);
         dbus_connection_register_object_path(c, i->path, &vtable, i);
         return avahi_dbus_respond_path(c, m, i->path);
 
@@ -927,7 +933,7 @@ static DBusHandlerResult msg_server_impl(DBusConnection *c, DBusMessage *m, AVAH
         i = avahi_new(AsyncAddressResolverInfo, 1);
         i->id = ++client->current_id;
         i->client = client;
-        i->path = avahi_strdup_printf("/Client%u/AddressResolver%u", client->id, i->id);
+        i->path = NULL;
         AVAHI_LLIST_PREPEND(AsyncAddressResolverInfo, async_address_resolvers, client->async_address_resolvers, i);
         client->n_objects++;
 
@@ -935,7 +941,8 @@ static DBusHandlerResult msg_server_impl(DBusConnection *c, DBusMessage *m, AVAH
             avahi_dbus_async_address_resolver_free(i);
             return avahi_dbus_respond_error(c, m, avahi_server_errno(avahi_server), NULL);
         }
-        
+
+        i->path = avahi_strdup_printf("/Client%u/AddressResolver%u", client->id, i->id);
         dbus_connection_register_object_path(c, i->path, &vtable, i);
         return avahi_dbus_respond_path(c, m, i->path);
         
@@ -985,7 +992,7 @@ static DBusHandlerResult msg_server_impl(DBusConnection *c, DBusMessage *m, AVAH
         i = avahi_new(RecordBrowserInfo, 1);
         i->id = ++client->current_id;
         i->client = client;
-        i->path = avahi_strdup_printf("/Client%u/RecordBrowser%u", client->id, i->id);
+        i->path = NULL;
         AVAHI_LLIST_PREPEND(RecordBrowserInfo, record_browsers, client->record_browsers, i);
         client->n_objects++;
 
@@ -1000,6 +1007,7 @@ static DBusHandlerResult msg_server_impl(DBusConnection *c, DBusMessage *m, AVAH
 
         avahi_key_unref(key);
         
+        i->path = avahi_strdup_printf("/Client%u/RecordBrowser%u", client->id, i->id);
         dbus_connection_register_object_path(c, i->path, &vtable, i);
         return avahi_dbus_respond_path(c, m, i->path);
     }
index 0ddd7b85aeacaa5bfbbf9f98d823380031de212a..ea23fe417448af42879599daaf591dd5e121eeba 100644 (file)
@@ -38,8 +38,11 @@ void avahi_dbus_record_browser_free(RecordBrowserInfo *i) {
 
     if (i->record_browser)
         avahi_s_record_browser_free(i->record_browser);
-    dbus_connection_unregister_object_path(server->bus, i->path);
-    avahi_free(i->path);
+
+    if (i->path) {
+        dbus_connection_unregister_object_path(server->bus, i->path);
+        avahi_free(i->path);
+    }
     AVAHI_LLIST_REMOVE(RecordBrowserInfo, record_browsers, i->client->record_browsers, i);
 
     i->client->n_objects--;
index 975cce92b54f10164fc124f80408e0c0392fca3b..29d79b6d4372b55416d12c8f607c424d5bf3acd3 100644 (file)
@@ -38,8 +38,12 @@ void avahi_dbus_service_browser_free(ServiceBrowserInfo *i) {
 
     if (i->service_browser)
         avahi_s_service_browser_free(i->service_browser);
-    dbus_connection_unregister_object_path(server->bus, i->path);
-    avahi_free(i->path);
+
+    if (i->path) {
+        dbus_connection_unregister_object_path(server->bus, i->path);
+        avahi_free(i->path);
+    }
+    
     AVAHI_LLIST_REMOVE(ServiceBrowserInfo, service_browsers, i->client->service_browsers, i);
 
     i->client->n_objects--;
index ac2a17cc367d4b286396d67d780cfaeb64c8e4a7..9207a74f049a058ba83aeaf92dec752d5c1f5e3c 100644 (file)
@@ -38,8 +38,12 @@ void avahi_dbus_service_type_browser_free(ServiceTypeBrowserInfo *i) {
 
     if (i->service_type_browser)
         avahi_s_service_type_browser_free(i->service_type_browser);
-    dbus_connection_unregister_object_path(server->bus, i->path);
-    avahi_free(i->path);
+
+    if (i->path) {
+        dbus_connection_unregister_object_path(server->bus, i->path);
+        avahi_free(i->path);
+    }
+    
     AVAHI_LLIST_REMOVE(ServiceTypeBrowserInfo, service_type_browsers, i->client->service_type_browsers, i);
 
     i->client->n_objects--;