From c84ce4c2d974d891712f0287932f57ed7e6be98d Mon Sep 17 00:00:00 2001 From: Pavel Rochnyack Date: Mon, 31 Jul 2017 12:13:15 +0700 Subject: [PATCH] Changed return type of sread() and swrite() from 'ssize_t' to 'int' Functions 'sread()' and 'swrite()', unlike 'read()' and 'write()', does not return the number of bytes actually read/written. They return error status, which is returned as 'int' type in Collectd code. --- src/daemon/common.c | 4 ++-- src/daemon/common.h | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/daemon/common.c b/src/daemon/common.c index 28c9798d..cf981dc0 100644 --- a/src/daemon/common.c +++ b/src/daemon/common.c @@ -212,7 +212,7 @@ void sfree (void **ptr) } #endif -ssize_t sread(int fd, void *buf, size_t count) { +int sread(int fd, void *buf, size_t count) { char *ptr; size_t nleft; ssize_t status; @@ -243,7 +243,7 @@ ssize_t sread(int fd, void *buf, size_t count) { return 0; } -ssize_t swrite(int fd, const void *buf, size_t count) { +int swrite(int fd, const void *buf, size_t count) { const char *ptr; size_t nleft; ssize_t status; diff --git a/src/daemon/common.h b/src/daemon/common.h index 59e99ec4..7f860521 100644 --- a/src/daemon/common.h +++ b/src/daemon/common.h @@ -90,7 +90,7 @@ char *sstrerror(int errnum, char *buf, size_t buflen); * Zero upon success or non-zero if an error occurred. `errno' is set in this * case. */ -ssize_t sread(int fd, void *buf, size_t count); +int sread(int fd, void *buf, size_t count); /* * NAME @@ -109,7 +109,7 @@ ssize_t sread(int fd, void *buf, size_t count); * Zero upon success or non-zero if an error occurred. `errno' is set in this * case. */ -ssize_t swrite(int fd, const void *buf, size_t count); +int swrite(int fd, const void *buf, size_t count); /* * NAME -- 2.30.2