In util.c, write may return EAGAIN if the file descriptor is a full pipe.
Currently, if this occurs, the log message "ccache: FATAL: Failed to copy fd"
is printed and ccache exits. We've seen this locally when the recorded stderr
output was exceptionally large due to many compilation warnings.
ssize_t count, written = 0;
do {
count = write(fd_out, buf + written, n - written);
- if (count == -1 && errno != EINTR) {
- fatal("Failed to copy fd");
+ if (count == -1) {
+ if (errno != EAGAIN && errno != EINTR) {
+ fatal("Failed to copy fd");
+ }
+ } else {
+ written += count;
}
- written += count;
} while (written < n);
}