Remove close() call from sread()
authorPavel Rochnyack <pavel2000@ngs.ru>
Fri, 26 May 2017 06:14:19 +0000 (12:14 +0600)
committerPavel Rochnyack <pavel2000@ngs.ru>
Wed, 11 Oct 2017 07:33:09 +0000 (14:33 +0700)
The sread() function should not close fd in any cases, that is unexpected.

src/daemon/common.c
src/daemon/common.h

index 6c856a6..28c9798 100644 (file)
@@ -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;
     }
 
index afd292a..59e99ec 100644 (file)
@@ -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.