summaryrefslogtreecommitdiff
path: root/src/libsystemd-bus
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2013-03-24 23:54:44 +0100
committerLennart Poettering <lennart@poettering.net>2013-03-25 02:33:35 +0100
commit66f931b4c818a5f9f7f36b2a0f3b0422609a6e8d (patch)
treeffddc93c594ae49db7a68cd2070409d100b98350 /src/libsystemd-bus
parent2c93b4efeca3ccf38d604d85490b796e875e2c31 (diff)
bus: properly handle termination of connections
Diffstat (limited to 'src/libsystemd-bus')
-rw-r--r--src/libsystemd-bus/sd-bus.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/libsystemd-bus/sd-bus.c b/src/libsystemd-bus/sd-bus.c
index 72c790bd59..941b33ab69 100644
--- a/src/libsystemd-bus/sd-bus.c
+++ b/src/libsystemd-bus/sd-bus.c
@@ -532,6 +532,8 @@ static int bus_read_auth(sd_bus *b) {
k = recvmsg(b->fd, &mh, MSG_DONTWAIT|MSG_NOSIGNAL);
if (k < 0)
return errno == EAGAIN ? 0 : -errno;
+ if (k == 0)
+ return -ECONNRESET;
b->rbuffer_size += k;
@@ -1058,6 +1060,8 @@ static int message_read(sd_bus *bus, sd_bus_message **m) {
k = recvmsg(bus->fd, &mh, MSG_DONTWAIT|MSG_NOSIGNAL|MSG_CMSG_CLOEXEC);
if (k < 0)
return errno == EAGAIN ? 0 : -errno;
+ if (k == 0)
+ return -ECONNRESET;
bus->rbuffer_size += k;