aboutsummaryrefslogtreecommitdiffstats
path: root/libsbus.c
diff options
context:
space:
mode:
Diffstat (limited to 'libsbus.c')
-rw-r--r--libsbus.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/libsbus.c b/libsbus.c
index 4a913ec..5b238c8 100644
--- a/libsbus.c
+++ b/libsbus.c
@@ -66,8 +66,11 @@ libsbus_receive(int fd, int flags, char *buf, union libsbus_packet *packet)
char *p;
r = recv(fd, buf, LIBSBUS_BUFFER_SIZE, flags);
- if (r < 0)
+ if (r <= 0) {
+ if (!r)
+ errno = ECONNRESET;
return -1;
+ }
if (r >= 4 && !strncmp(buf, "MSG ", 4)) {
p = memchr(buf, '\0', r);