From: Eric Bollengier Date: Thu, 5 Aug 2021 07:35:19 +0000 (+0200) Subject: Map size_t/ssize_t read()/write() type to full_read()/full_write() in fd_common X-Git-Tag: Release-11.3.2~415 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ba74c60657371f97f3023970912e7ea0a00a4692;p=thirdparty%2Fbacula.git Map size_t/ssize_t read()/write() type to full_read()/full_write() in fd_common --- diff --git a/bacula/src/plugins/fd/fd_common.h b/bacula/src/plugins/fd/fd_common.h index 3d5517def..9ed3e5bb4 100644 --- a/bacula/src/plugins/fd/fd_common.h +++ b/bacula/src/plugins/fd/fd_common.h @@ -803,8 +803,9 @@ cleanup: /* Handle signal when reading from a pipe, functions based on * fread doesn't work very well. */ -static int32_t full_read(int in, char *buf, int32_t nbytes) { - ssize_t nleft, nread; +static int32_t full_read(int in, char *buf, uint32_t nbytes) { + size_t nleft; + ssize_t nread; nleft = nbytes; while (nleft > 0) { @@ -831,10 +832,12 @@ static int32_t full_read(int in, char *buf, int32_t nbytes) { #endif #ifdef USE_FULL_WRITE -static int32_t full_write(int fd, const char *ptr, int32_t nbytes, bool *canceled=NULL) +static int32_t full_write(int fd, const char *ptr, uint32_t nbytes, bool *canceled=NULL) { - ssize_t nleft, nwritten; + size_t nleft; + ssize_t nwritten; nleft = nbytes; + while (nleft > 0 && (canceled == NULL || *canceled == false)) { do { errno = 0;