From: Remi Gacogne Date: Fri, 10 Jun 2016 12:29:31 +0000 (+0200) Subject: auth: Handle `read()` returning 0 in RemoteBackend's unix connector X-Git-Tag: auth-4.0.0-rc1~51^2~3^2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=refs%2Fpull%2F3973%2Fhead;p=thirdparty%2Fpdns.git 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 --- diff --git a/modules/remotebackend/unixconnector.cc b/modules/remotebackend/unixconnector.cc index 5c5a7216fc..f997183e21 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;