X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Fdaemon%2Fcommon.c;h=28c9798db2d7fdd638b98824a57adf8ba80ea50c;hb=11fd0bc0ed5969e7f1fd218e77c905fe2f414023;hp=3ae61d8592e5df6b3f42986f0e1131ef5682ace3;hpb=68c08bd380d63281f5707e893c27f952c5fde1d8;p=collectd.git diff --git a/src/daemon/common.c b/src/daemon/common.c index 3ae61d85..28c9798d 100644 --- a/src/daemon/common.c +++ b/src/daemon/common.c @@ -230,10 +230,7 @@ ssize_t sread(int fd, void *buf, size_t count) { return status; if (status == 0) { - DEBUG("Received EOF from fd %i. " - "Closing fd and returning error.", - fd); - close(fd); + DEBUG("Received EOF from fd %i. ", fd); return -1; } @@ -269,7 +266,8 @@ ssize_t swrite(int fd, const void *buf, size_t count) { if (recv(fd, buffer, sizeof(buffer), MSG_PEEK | MSG_DONTWAIT) == 0) { /* if recv returns zero (even though poll() said there is data to be * read), that means the connection has been closed */ - return errno ? errno : -1; + errno = ECONNRESET; + return -1; } }