blob: 0e9351a60de0f5877e440660ced99e1fd179c39e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
/* ISC license. */
#include <errno.h>
#include <skalibs/allreadwrite.h>
size_t allreadwrite (io_func_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 ;
}
|