blob: 4725ced884338ff8870d190b0079639d1ce3344b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
/* See LICENSE file for copyright and license details. */
#include <unistd.h>
#include "../util.h"
ssize_t
writeall(int fd, const void *buf, size_t len)
{
const char *p = buf;
ssize_t n;
while (len) {
n = write(fd, p, len);
if (n <= 0)
return n;
p += n;
len -= n;
}
return p - (const char *)buf;
}
|