summaryrefslogtreecommitdiff
path: root/src/libstddjb/fd_catn.c
diff options
context:
space:
mode:
authorLaurent Bercot <ska-skaware@skarnet.org>2017-02-15 17:40:40 +0000
committerLaurent Bercot <ska-skaware@skarnet.org>2017-02-15 17:40:40 +0000
commita896ca2a8c617e5e00ffd5fc9e69331ad754e5b3 (patch)
treef49a8382b9999b5aa00c0885eedd5c5c3a233e55 /src/libstddjb/fd_catn.c
parent00c9cb1b22cc17c4db573e0e613a5f116ff0092e (diff)
downloadskalibs-a896ca2a8c617e5e00ffd5fc9e69331ad754e5b3.tar.xz
add arc4random_addrandom sysdep; next batch of types changes.
The library isn't supposed to be functional yet: there are still a lot of type mismatches.
Diffstat (limited to 'src/libstddjb/fd_catn.c')
-rw-r--r--src/libstddjb/fd_catn.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/libstddjb/fd_catn.c b/src/libstddjb/fd_catn.c
index ca78546..b757853 100644
--- a/src/libstddjb/fd_catn.c
+++ b/src/libstddjb/fd_catn.c
@@ -1,20 +1,21 @@
/* ISC license. */
+#include <sys/types.h>
#include <errno.h>
#include <skalibs/allreadwrite.h>
#include <skalibs/iobuffer.h>
#include <skalibs/djbunix.h>
-unsigned int fd_catn (int from, int to, unsigned int n)
+size_t fd_catn (int from, int to, size_t n)
{
- unsigned int w = 0 ;
+ size_t w = 0 ;
if (n >= IOBUFFER_SIZE)
{
iobuffer b ;
if (!iobuffer_init(&b, from, to)) return 0 ;
while (n >= IOBUFFER_SIZE)
{
- register int r = iobuffer_fill(&b) ;
+ register ssize_t r = iobuffer_fill(&b) ;
if (r <= 0)
{
iobuffer_finish(&b) ;
@@ -33,8 +34,8 @@ unsigned int fd_catn (int from, int to, unsigned int n)
{
char buf[n] ;
- unsigned int r = allread(from, buf, n) ;
- unsigned int v = 0 ;
+ size_t r = allread(from, buf, n) ;
+ size_t v = 0 ;
if (r) v = allwrite(to, buf, r) ;
w += v ;
}