summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2013-12-10 23:06:50 +0000
committerLennart Poettering <lennart@poettering.net>2013-12-10 23:06:50 +0000
commita82cafb97bf841deded572cd4ade039853cbdc4e (patch)
treec8a14927e7f44265e6c34715cce3462bd2321ab9
parent80caea6cc72ebd311a311b1527cc6b87201c13bf (diff)
bus: don't generate assert warnings when we detach a detached bus from an event
-rw-r--r--src/libsystemd-bus/sd-bus.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/libsystemd-bus/sd-bus.c b/src/libsystemd-bus/sd-bus.c
index 91fac4815e..0a2ce3eb8d 100644
--- a/src/libsystemd-bus/sd-bus.c
+++ b/src/libsystemd-bus/sd-bus.c
@@ -2645,7 +2645,9 @@ fail:
_public_ int sd_bus_detach_event(sd_bus *bus) {
assert_return(bus, -EINVAL);
- assert_return(bus->event, -ENXIO);
+
+ if (!bus->event)
+ return 0;
if (bus->input_io_event_source) {
sd_event_source_set_enabled(bus->input_io_event_source, SD_EVENT_OFF);
@@ -2670,7 +2672,7 @@ _public_ int sd_bus_detach_event(sd_bus *bus) {
if (bus->event)
bus->event = sd_event_unref(bus->event);
- return 0;
+ return 1;
}
_public_ sd_event* sd_bus_get_event(sd_bus *bus) {