From: Pavel Rochnyack Date: Mon, 31 Jul 2017 05:13:15 +0000 (+0700) Subject: Changed return type of sread() and swrite() from 'ssize_t' to 'int' X-Git-Tag: collectd-5.8.0~42^2 X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=c84ce4c2d974d891712f0287932f57ed7e6be98d;p=collectd.git 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. --- 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