]> source.dussan.org Git - rspamd.git/commitdiff
Fix stupid deadlock in the logger. rspamd-0.7
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Mon, 22 Dec 2014 17:31:53 +0000 (17:31 +0000)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Mon, 22 Dec 2014 17:57:35 +0000 (17:57 +0000)
src/libutil/logger.c

index 2cb51cbb83a893356e95893e22c625ed88d02e82..905804ca469bd3d397188e861a991aafecef7f8e 100644 (file)
@@ -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;