diff options
author | Joshua Colp <jcolp@digium.com> | 2017-01-30 12:50:05 -0600 |
---|---|---|
committer | Gerrit Code Review <gerrit2@gerrit.digium.api> | 2017-01-30 12:50:05 -0600 |
commit | 5b42dd7ae3aec6c2f1137299a626e02ed08bb168 (patch) | |
tree | 0dd52e549e8d116f6807a1cfcd50d148a0a55996 /main | |
parent | bb1e9e1b58640703b9dfa7c882170727d072fa0b (diff) | |
parent | 7eaaa8bedc0ba95bfe618c8e26a66467d60439a0 (diff) |
Merge "ast_careful_fwrite to support EPIPE gracefully" into 14
Diffstat (limited to 'main')
-rw-r--r-- | main/utils.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/main/utils.c b/main/utils.c index 1ca77ce74..14d529cf4 100644 --- a/main/utils.c +++ b/main/utils.c @@ -1448,7 +1448,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)); } @@ -1481,8 +1483,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; |