From: Lennart Poettering Date: Sun, 24 Mar 2013 22:54:44 +0000 (+0100) Subject: bus: properly handle termination of connections X-Git-Tag: v199~47 X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=elogind.git;a=commitdiff_plain;h=66f931b4c818a5f9f7f36b2a0f3b0422609a6e8d bus: properly handle termination of connections --- diff --git a/src/libsystemd-bus/sd-bus.c b/src/libsystemd-bus/sd-bus.c index 72c790bd5..941b33ab6 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;