[ccache] [PATCH] handle EAGAIN during copy_fd
Alfred Landrum
alfred.landrum at riverbed.com
Fri Aug 31 12:30:57 MDT 2012
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.
diff -u -r ccache-3.1.8/util.c ccache-3.1.8-eagain-patch/util.c
--- ccache-3.1.8/util.c 2012-08-11 02:03:17.000000000 -0700
+++ ccache-3.1.8-eagain-patch/util.c 2012-08-30 12:54:42.992117460 -0700
@@ -149,10 +149,13 @@
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);
}
More information about the ccache
mailing list