From c99c09a2dc0f72e6f10449c9e110158612a43ab6 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Wed, 27 Nov 2013 20:24:10 +0100 Subject: bus: properly handle if we get disconnected during HELLO phase --- src/libsystemd-bus/sd-bus.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/libsystemd-bus/sd-bus.c b/src/libsystemd-bus/sd-bus.c index 1207d5ad2e..f13e346dcf 100644 --- a/src/libsystemd-bus/sd-bus.c +++ b/src/libsystemd-bus/sd-bus.c @@ -380,7 +380,7 @@ static int hello_callback(sd_bus *bus, sd_bus_message *reply, void *userdata, sd int r; assert(bus); - assert(bus->state == BUS_HELLO); + assert(bus->state == BUS_HELLO || bus->state == BUS_CLOSING); assert(reply); r = sd_bus_message_get_errno(reply); @@ -400,7 +400,8 @@ static int hello_callback(sd_bus *bus, sd_bus_message *reply, void *userdata, sd if (!bus->unique_name) return -ENOMEM; - bus->state = BUS_RUNNING; + if (bus->state == BUS_HELLO) + bus->state = BUS_RUNNING; return 1; } -- cgit v1.2.3-54-g00ecf