summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2014-12-22 17:31:53 +0000
committerVsevolod Stakhov <vsevolod@highsecure.ru>2014-12-22 17:31:53 +0000
commit76243f9769c42055a5d5523a017b8540d10ceae4 (patch)
tree08ef5d375d0388590a321417dbd3408f490ef5f4
parent51684e4fec3b8faa6bf443d4ee962f3f391a8997 (diff)
downloadrspamd-76243f9769c42055a5d5523a017b8540d10ceae4.tar.gz
rspamd-76243f9769c42055a5d5523a017b8540d10ceae4.zip
Fix stupid deadlock in the logger.
-rw-r--r--src/libutil/logger.c16
1 files changed, 7 insertions, 9 deletions
diff --git a/src/libutil/logger.c b/src/libutil/logger.c
index 2cb51cbb8..905804ca4 100644
--- a/src/libutil/logger.c
+++ b/src/libutil/logger.c
@@ -113,19 +113,17 @@ direct_write_log_line (rspamd_logger_t *rspamd_log,
}
if (r == -1) {
/* We cannot write message to file, so we need to detect error and make decision */
+ if (errno == EINTR) {
+ /* Try again */
+ direct_write_log_line (rspamd_log, data, count, is_iov);
+ return;
+ }
+
r = rspamd_snprintf (errmsg,
sizeof (errmsg),
"direct_write_log_line: cannot write log line: %s",
strerror (errno));
- if (errno == EIO || errno == EINTR) {
- /* Descriptor is somehow invalid, try to restart */
- rspamd_log_reopen (rspamd_log);
- if (write (rspamd_log->fd, errmsg, r) != -1) {
- /* Try again */
- direct_write_log_line (rspamd_log, data, count, is_iov);
- }
- }
- else if (errno == EFAULT || errno == EINVAL || errno == EFBIG ||
+ if (errno == EFAULT || errno == EINVAL || errno == EFBIG ||
errno == ENOSPC) {
/* Rare case */
rspamd_log->throttling = TRUE;