assert(m);
assert(e);
+ sd_bus_close(bus);
sd_event_exit(e, 0);
+
return 1;
}
return r;
if (r == 0 && !exiting) {
- r = bus_async_unregister_and_exit(e, bus, name);
+
+ r = sd_bus_try_close(bus);
+ if (r == -EBUSY)
+ continue;
+
+ if (r == -ENOTSUP) {
+ /* Fallback for dbus1 connections: we
+ * unregister the name and wait for
+ * the response to come through for
+ * it */
+
+ r = bus_async_unregister_and_exit(e, bus, name);
+ if (r < 0)
+ return r;
+
+ exiting = true;
+ continue;
+ }
+
if (r < 0)
return r;
- exiting = true;
+ sd_event_exit(e, 0);
+ break;
}
}
return r;
}
-int bus_property_get_tristate(
- sd_bus *bus,
- const char *path,
- const char *interface,
- const char *property,
- sd_bus_message *reply,
- void *userdata,
- sd_bus_error *error) {
-
- int *tristate = userdata;
-
- return sd_bus_message_append(reply, "b", *tristate > 0);
-}
-
int bus_property_get_bool(
sd_bus *bus,
const char *path,
if (r < 0)
return bus_log_create_error(r);
- r = sd_bus_message_append(m, "v", "t", (usec_t) -1);
+ r = sd_bus_message_append(m, "v", "t", USEC_INFINITY);
} else if (endswith(eq, "%")) {
double percent;