From 630f9fdcc7539bb2f98f1954296ea11ef7d01b2c Mon Sep 17 00:00:00 2001 From: Remi Gacogne Date: Fri, 10 Jun 2016 14:29:31 +0200 Subject: [PATCH] auth: Handle `read()` returning 0 in RemoteBackend's unix connector Otherwise it looks like we may loop in `recv_message()` until the timeout is reached if the other end closes the connection: * `waitForData()` will return immediately * `read()` will keep returning 0 --- modules/remotebackend/unixconnector.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/remotebackend/unixconnector.cc b/modules/remotebackend/unixconnector.cc index 5c5a7216f..f997183e2 100644 --- a/modules/remotebackend/unixconnector.cc +++ b/modules/remotebackend/unixconnector.cc @@ -89,7 +89,7 @@ ssize_t UnixsocketConnector::read(std::string &data) { // just try again later... if (nread==-1 && errno == EAGAIN) return 0; - if (nread==-1) { + if (nread==-1 || nread==0) { connected = false; close(fd); return -1; -- 2.40.0