chiark / gitweb /
core: fix bus serialization of conditions
[elogind.git] / src / core / dbus-unit.c
index 5fca7653e0b2a795f47070a531468a359aaadeb3..666c97c98d1e5cb9c064ac6501848bcbf4cbc1d0 100644 (file)
@@ -326,7 +326,10 @@ static int property_get_conditions(
                 return r;
 
         LIST_FOREACH(conditions, c, u->conditions) {
-                r = sd_bus_message_append(reply, "sbbsi", condition_type_to_string(c->type), c->trigger, c->negate, c->parameter, c->state);
+                r = sd_bus_message_append(reply, "(sbbsi)",
+                                          condition_type_to_string(c->type),
+                                          c->trigger, c->negate,
+                                          c->parameter, c->state);
                 if (r < 0)
                         return r;
 
@@ -664,7 +667,6 @@ static int send_changed_signal(sd_bus *bus, const char *destination, void *userd
 
 void bus_unit_send_change_signal(Unit *u) {
         int r;
-
         assert(u);
 
         if (u->in_dbus_queue) {
@@ -677,7 +679,7 @@ void bus_unit_send_change_signal(Unit *u) {
 
         r = bus_manager_foreach_client(u->manager, u->sent_dbus_new_signal ? send_changed_signal : send_new_signal, u);
         if (r < 0)
-                log_warning("Failed to send unit change signal for %s: %s", u->id, strerror(-r));
+                log_debug("Failed to send unit change signal for %s: %s", u->id, strerror(-r));
 
         u->sent_dbus_new_signal = true;
 }
@@ -713,7 +715,6 @@ static int send_removed_signal(sd_bus *bus, const char *destination, void *userd
 
 void bus_unit_send_removed_signal(Unit *u) {
         int r;
-
         assert(u);
 
         if (!u->sent_dbus_new_signal)
@@ -724,7 +725,7 @@ void bus_unit_send_removed_signal(Unit *u) {
 
         r = bus_manager_foreach_client(u->manager, send_removed_signal, u);
         if (r < 0)
-                log_warning("Failed to send unit change signal for %s: %s", u->id, strerror(-r));
+                log_debug("Failed to send unit remove signal for %s: %s", u->id, strerror(-r));
 }
 
 int bus_unit_queue_job(
@@ -780,7 +781,7 @@ int bus_unit_queue_job(
 
         path = job_dbus_path(j);
         if (!path)
-                return r;
+                return -ENOMEM;
 
         return sd_bus_reply_method_return(message, "o", path);
 }
@@ -895,6 +896,10 @@ static int bus_unit_set_transient_property(
                 if (r < 0)
                         return r;
 
+                r = sd_bus_message_exit_container(message);
+                if (r < 0)
+                        return r;
+
                 return 1;
         }
 
@@ -941,6 +946,7 @@ int bus_unit_set_properties(
                         r = sd_bus_message_rewind(message, false);
                         if (r < 0)
                                 return r;
+
                         for_real = true;
                         continue;
                 }
@@ -975,6 +981,10 @@ int bus_unit_set_properties(
                 n += for_real;
         }
 
+        r = sd_bus_message_exit_container(message);
+        if (r < 0)
+                return r;
+
         if (commit && n > 0 && UNIT_VTABLE(u)->bus_commit_properties)
                 UNIT_VTABLE(u)->bus_commit_properties(u);