[systemd-commits] 3 commits - src/libsystemd-bus

Lennart Poettering lennart at kemper.freedesktop.org
Tue Oct 8 18:31:57 PDT 2013


 src/libsystemd-bus/bus-message.c   |   11 ++++++++++-
 src/libsystemd-bus/sd-bus.c        |   21 ++++++++++-----------
 src/libsystemd-bus/test-bus-chat.c |    2 +-
 3 files changed, 21 insertions(+), 13 deletions(-)

New commits:
commit bb874efc38624cab70b7abecb044a87ea66d049f
Author: Lennart Poettering <lennart at poettering.net>
Date:   Wed Oct 9 03:28:59 2013 +0200

    bus: fix GetAll() userdata passing

diff --git a/src/libsystemd-bus/sd-bus.c b/src/libsystemd-bus/sd-bus.c
index 5135253..993c2e6 100644
--- a/src/libsystemd-bus/sd-bus.c
+++ b/src/libsystemd-bus/sd-bus.c
@@ -4033,7 +4033,7 @@ static int emit_properties_changed_on_interface(
                 if (r < 0)
                         return r;
 
-                r = v->vtable->property.get(bus, m->path, interface, *property, m, &error, u);
+                r = v->vtable->property.get(bus, m->path, interface, *property, m, &error, vtable_property_convert_userdata(v->vtable, u));
                 if (r < 0)
                         return r;
 

commit 486e950bd91092a3b1be73f54c901c6c28cab0a2
Author: Lennart Poettering <lennart at poettering.net>
Date:   Wed Oct 9 03:27:22 2013 +0200

    bus: don't require that if a child object node exists its parent node must too

diff --git a/src/libsystemd-bus/sd-bus.c b/src/libsystemd-bus/sd-bus.c
index b1dcd8d..5135253 100644
--- a/src/libsystemd-bus/sd-bus.c
+++ b/src/libsystemd-bus/sd-bus.c
@@ -1887,7 +1887,6 @@ static int node_vtable_get_userdata(
         assert(bus);
         assert(path);
         assert(c);
-        assert(userdata);
 
         u = c->userdata;
         if (c->find) {
@@ -1896,7 +1895,9 @@ static int node_vtable_get_userdata(
                         return r;
         }
 
-        *userdata = u;
+        if (userdata)
+                *userdata = u;
+
         return 1;
 }
 
@@ -2344,8 +2345,8 @@ static bool bus_node_exists(sd_bus *bus, struct node *n, const char *path, bool
         assert(bus);
         assert(n);
 
-        if (n->child)
-                return true;
+        /* Tests if there's anything attached directly to this node
+         * for the specified path */
 
         LIST_FOREACH(callbacks, k, n->callbacks) {
                 if (require_fallback && !k->is_fallback)
@@ -2359,11 +2360,11 @@ static bool bus_node_exists(sd_bus *bus, struct node *n, const char *path, bool
                 if (require_fallback && !c->is_fallback)
                         continue;
 
-                return true;
+                if (node_vtable_get_userdata(bus, path, c, NULL) > 0)
+                        return true;
         }
 
         return !require_fallback && (n->enumerators || n->object_manager);
-
 }
 
 static int process_introspect(
@@ -2400,12 +2401,10 @@ static int process_introspect(
         empty = set_isempty(s);
 
         LIST_FOREACH(vtables, c, n->vtables) {
-                void *u;
-
                 if (require_fallback && !c->is_fallback)
                         continue;
 
-                r = node_vtable_get_userdata(bus, m->path, c, &u);
+                r = node_vtable_get_userdata(bus, m->path, c, NULL);
                 if (r < 0)
                         return r;
                 if (r == 0)
@@ -3961,7 +3960,7 @@ static int emit_properties_changed_on_interface(
         struct node_vtable *c;
         struct node *n;
         char **property;
-        void *u;
+        void *u = NULL;
         int r;
 
         assert(bus);

commit 3a7d4f1ba42bddd0cbaa5e0d9482dc5bd30d803f
Author: Lennart Poettering <lennart at poettering.net>
Date:   Wed Oct 9 03:26:34 2013 +0200

    bus: fix synthetic error messages

diff --git a/src/libsystemd-bus/bus-message.c b/src/libsystemd-bus/bus-message.c
index 2cf1a7a..264a2f6 100644
--- a/src/libsystemd-bus/bus-message.c
+++ b/src/libsystemd-bus/bus-message.c
@@ -682,7 +682,6 @@ fail:
         return r;
 }
 
-
 int bus_message_new_synthetic_error(
                 sd_bus *bus,
                 uint64_t serial,
@@ -712,6 +711,16 @@ int bus_message_new_synthetic_error(
                         goto fail;
         }
 
+        r = message_append_field_string(t, SD_BUS_MESSAGE_HEADER_ERROR_NAME, SD_BUS_TYPE_STRING, e->name, &t->error.name);
+        if (r < 0)
+                goto fail;
+
+        if (e->message) {
+                r = message_append_basic(t, SD_BUS_TYPE_STRING, e->message, (const void**) &t->error.message);
+                if (r < 0)
+                        goto fail;
+        }
+
         *m = t;
         return 0;
 
diff --git a/src/libsystemd-bus/test-bus-chat.c b/src/libsystemd-bus/test-bus-chat.c
index f308edd..aefe8f1 100644
--- a/src/libsystemd-bus/test-bus-chat.c
+++ b/src/libsystemd-bus/test-bus-chat.c
@@ -359,7 +359,7 @@ finish:
 static int quit_callback(sd_bus *b, sd_bus_message *m, void *userdata) {
         bool *x = userdata;
 
-        log_error("Quit callback: %s", strerror(bus_message_to_errno(m)));
+        log_error("Quit callback: %s", strerror(-bus_message_to_errno(m)));
 
         *x = 1;
         return 1;



More information about the systemd-commits mailing list