static void log_error_callback(void *context ATTR_UNUSED)
{
+ /* the log fd is closed, don't die when trying to log later */
+ i_set_failure_ignore_errors(TRUE);
+
io_loop_stop(ioloop);
}
static void log_error_callback(void *context ATTR_UNUSED)
{
+ /* the log fd is closed, don't die when trying to log later */
+ i_set_failure_ignore_errors(TRUE);
+
io_loop_stop(ioloop);
}
static int log_fd = STDERR_FILENO, log_info_fd = STDERR_FILENO;
static char *log_prefix = NULL, *log_stamp_format = NULL;
+static bool failure_ignore_errors = FALSE;
/* kludgy .. we want to trust log_stamp_format with -Wformat-nonliteral */
static const char *get_log_stamp_format(const char *unused)
ret = log_fd_write(fd, str_data(str), str_len(str));
} T_END;
+ if (ret < 0 && failure_ignore_errors)
+ ret = 0;
+
recursed--;
return ret;
}
ret = write_full(2, str_data(str), str_len(str));
} T_END;
+ if (ret < 0 && failure_ignore_errors)
+ ret = 0;
+
recursed--;
return ret;
}
i_set_info_handler(i_internal_error_handler);
}
+void i_set_failure_ignore_errors(bool ignore)
+{
+ failure_ignore_errors = ignore;
+}
+
void i_set_info_file(const char *path)
{
if (log_info_fd == log_fd)
/* Send errors to stderr using internal error protocol. */
void i_set_failure_internal(void);
+/* If writing to log fails, ignore it instead of existing with
+ FATAL_LOGWRITE or FATAL_LOGERROR. */
+void i_set_failure_ignore_errors(bool ignore);
/* Send informational messages to specified log file. i_set_failure_*()
functions modify the info file too, so call this function after them. */
static void log_error_callback(void *context ATTR_UNUSED)
{
+ /* the log fd is closed, don't die when trying to log later */
+ i_set_failure_ignore_errors(TRUE);
+
io_loop_stop(ioloop);
}