From: Pavel Rochnyack Date: Fri, 26 May 2017 06:14:19 +0000 (+0600) Subject: Remove close() call from sread() X-Git-Tag: collectd-5.8.0~42^2~2 X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=11fd0bc0ed5969e7f1fd218e77c905fe2f414023;p=collectd.git Remove close() call from sread() The sread() function should not close fd in any cases, that is unexpected. --- diff --git a/src/daemon/common.c b/src/daemon/common.c index 6c856a6b..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; } diff --git a/src/daemon/common.h b/src/daemon/common.h index afd292a3..59e99ec4 100644 --- a/src/daemon/common.h +++ b/src/daemon/common.h @@ -79,8 +79,7 @@ char *sstrerror(int errnum, char *buf, size_t buflen); * * DESCRIPTION * Reads exactly `n' bytes or fails. Syntax and other behavior is analogous - * to `read(2)'. If EOF is received the file descriptor is closed and an - * error is returned. + * to `read(2)'. * * PARAMETERS * `fd' File descriptor to write to.