summaryrefslogtreecommitdiff
path: root/src/libsystemd-bus/sd-bus.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2013-11-27 20:24:10 +0100
committerLennart Poettering <lennart@poettering.net>2013-11-27 20:28:48 +0100
commitc99c09a2dc0f72e6f10449c9e110158612a43ab6 (patch)
tree6da7a90d750589f1baab8e38b1aef72fb3d5c4e9 /src/libsystemd-bus/sd-bus.c
parent613b411c947635136637f8cdd66b94512f761eab (diff)
bus: properly handle if we get disconnected during HELLO phase
Diffstat (limited to 'src/libsystemd-bus/sd-bus.c')
-rw-r--r--src/libsystemd-bus/sd-bus.c5
1 files changed, 3 insertions, 2 deletions
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;
}