From 11fd0bc0ed5969e7f1fd218e77c905fe2f414023 Mon Sep 17 00:00:00 2001 From: Pavel Rochnyack Date: Fri, 26 May 2017 12:14:19 +0600 Subject: [PATCH] Remove close() call from sread() The sread() function should not close fd in any cases, that is unexpected. --- src/daemon/common.c | 5 +---- src/daemon/common.h | 3 +-- 2 files changed, 2 insertions(+), 6 deletions(-) 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. -- 2.11.0