blob: 2eaae12f4c601d5a374ea37071ee1a27d942d834 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
/* ISC license. */
#include <sys/types.h>
#include <errno.h>
#include <skalibs/functypes.h>
#include <skalibs/allreadwrite.h>
size_t allreadwrite (iofunc_t_ref op, int fd, char *buf, size_t len)
{
size_t written = 0 ;
while (len)
{
ssize_t w = (*op)(fd, buf, len) ;
if (w <= 0)
{
if (!w) errno = 0 ;
break ;
}
written += w ;
buf += w ;
len -= w ;
}
return written ;
}
|