From a82cafb97bf841deded572cd4ade039853cbdc4e Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Tue, 10 Dec 2013 23:06:50 +0000 Subject: bus: don't generate assert warnings when we detach a detached bus from an event --- src/libsystemd-bus/sd-bus.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/libsystemd-bus') 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) { -- cgit v1.2.3-54-g00ecf