summaryrefslogtreecommitdiff
path: root/main
diff options
context:
space:
mode:
authorJoshua Colp <jcolp@digium.com>2017-01-30 11:52:05 -0600
committerGerrit Code Review <gerrit2@gerrit.digium.api>2017-01-30 11:52:05 -0600
commitd2f30f022511c4d0d0360d1a3b815f8186ea59bc (patch)
tree40efb861eba0be8eda754b575650bde48cffd01e /main
parentfd3f69cd05842dcc5ffaf711325b839087bcbb93 (diff)
parent555e8cd2ba3d6e24ce678e7ebc0fb9a8895ead65 (diff)
Merge "ast_careful_fwrite to support EPIPE gracefully" into 13
Diffstat (limited to 'main')
-rw-r--r--main/utils.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/main/utils.c b/main/utils.c
index 253df8d03..de7ff8f90 100644
--- a/main/utils.c
+++ b/main/utils.c
@@ -1453,7 +1453,9 @@ int ast_careful_fwrite(FILE *f, int fd, const char *src, size_t len, int timeout
if (ferror(f) && errno != EINTR && errno != EAGAIN) {
/* fatal error from fwrite() */
- if (!feof(f)) {
+ if (errno == EPIPE) {
+ ast_debug(1, "fwrite() failed due to reading end being closed: EPIPE\n");
+ } else if (!feof(f)) {
/* Don't spam the logs if it was just that the connection is closed. */
ast_log(LOG_ERROR, "fwrite() returned error: %s\n", strerror(errno));
}
@@ -1486,8 +1488,12 @@ int ast_careful_fwrite(FILE *f, int fd, const char *src, size_t len, int timeout
continue;
}
if (errno && !feof(f)) {
- /* Don't spam the logs if it was just that the connection is closed. */
- ast_log(LOG_ERROR, "fflush() returned error: %s\n", strerror(errno));
+ if (errno == EPIPE) {
+ ast_debug(1, "fflush() failed due to reading end being closed: EPIPE\n");
+ } else {
+ /* Don't spam the logs if it was just that the connection is closed. */
+ ast_log(LOG_ERROR, "fflush() returned error: %s\n", strerror(errno));
+ }
}
n = -1;
break;