aboutsummaryrefslogtreecommitdiffstats
path: root/src/daemon.c
diff options
context:
space:
mode:
authorMattias Andrée <maandree@member.fsf.org>2016-01-01 09:34:28 +0100
committerMattias Andrée <maandree@member.fsf.org>2016-01-01 09:34:28 +0100
commit75eab72cf3e5d70f55af52c62ea5adc11294dc26 (patch)
treebbfafeb6b8d0a4b9eb118519642955a0c6975a09 /src/daemon.c
parentsmall improvements and cleanup (diff)
downloadsat-75eab72cf3e5d70f55af52c62ea5adc11294dc26.tar.gz
sat-75eab72cf3e5d70f55af52c62ea5adc11294dc26.tar.bz2
sat-75eab72cf3e5d70f55af52c62ea5adc11294dc26.tar.xz
further improvement
Signed-off-by: Mattias Andrée <maandree@member.fsf.org>
Diffstat (limited to '')
-rw-r--r--src/daemon.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/daemon.c b/src/daemon.c
index e4c444e..ee05cf7 100644
--- a/src/daemon.c
+++ b/src/daemon.c
@@ -103,6 +103,8 @@ pwriten(int fildes, const void *buf, size_t nbyte, size_t offset)
/**
* Wrapper for `read` that reads all available data.
*
+ * `errno` is set to `EBADMSG` on success.
+ *
* @param fd The file descriptor from which to to read.
* @param buf Output parameter for the data.
* @param n Output parameter for the number of read bytes.
@@ -131,7 +133,7 @@ readall(int fd, char **buf, size_t *n)
new = realloc(buffer, *n = ptr);
*buf = ptr ? (new ? new : buffer) : NULL;
shutdown(SOCK_FILENO, SHUT_RD);
- return 0;
+ return errno = EBADMSG, 0;
fail:
saved_errno = errno;