From ba74c60657371f97f3023970912e7ea0a00a4692 Mon Sep 17 00:00:00 2001 From: Eric Bollengier Date: Thu, 5 Aug 2021 09:35:19 +0200 Subject: [PATCH] Map size_t/ssize_t read()/write() type to full_read()/full_write() in fd_common --- bacula/src/plugins/fd/fd_common.h | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) 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; -- 2.47.3