in xar/FileUtil.h [33:52]
ssize_t wrapFull(F f, int fd, void* buf, size_t count) {
char* b = static_cast<char*>(buf);
ssize_t totalBytes = 0;
ssize_t r;
do {
r = f(fd, b, count);
if (r == -1) {
if (errno == EINTR) {
continue;
}
return r;
}
totalBytes += r;
b += r;
count -= r;
} while (r != 0 && count); // 0 means EOF
return totalBytes;
}