mirror of
https://github.com/asterisk/asterisk.git
synced 2025-10-13 08:13:22 +00:00
Merge "ast_careful_fwrite to support EPIPE gracefully" into 13
This commit is contained in:
@@ -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) {
|
if (ferror(f) && errno != EINTR && errno != EAGAIN) {
|
||||||
/* fatal error from fwrite() */
|
/* 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. */
|
/* 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));
|
ast_log(LOG_ERROR, "fwrite() returned error: %s\n", strerror(errno));
|
||||||
}
|
}
|
||||||
@@ -1486,9 +1488,13 @@ int ast_careful_fwrite(FILE *f, int fd, const char *src, size_t len, int timeout
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (errno && !feof(f)) {
|
if (errno && !feof(f)) {
|
||||||
|
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. */
|
/* 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));
|
ast_log(LOG_ERROR, "fflush() returned error: %s\n", strerror(errno));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
n = -1;
|
n = -1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user