dovecot: Make failure_log_type_prefixes[] and failure_exit() pub...
dovecot at dovecot.org
dovecot at dovecot.org
Thu Dec 27 22:51:28 EET 2007
details: http://hg.dovecot.org/dovecot/rev/cc70ab74f4f3
changeset: 7041:cc70ab74f4f3
user: Timo Sirainen <tss at iki.fi>
date: Thu Dec 27 22:51:28 2007 +0200
description:
Make failure_log_type_prefixes[] and failure_exit() public.
diffstat:
2 files changed, 9 insertions(+), 6 deletions(-)
src/lib/failures.c | 11 +++++------
src/lib/failures.h | 4 ++++
diffs (70 lines):
diff -r 5e0f115665bf -r cc70ab74f4f3 src/lib/failures.c
--- a/src/lib/failures.c Sun Dec 23 16:31:54 2007 +0200
+++ b/src/lib/failures.c Thu Dec 27 22:51:28 2007 +0200
@@ -14,7 +14,7 @@
#include <syslog.h>
#include <time.h>
-static const char *log_type_prefixes[] = {
+const char *failure_log_type_prefixes[] = {
"Info: ",
"Warning: ",
"Error: ",
@@ -25,8 +25,6 @@ static char log_type_internal_chars[] =
'I', 'W', 'E', 'F', 'P'
};
-static void failure_exit(int status) ATTR_NORETURN;
-
static void default_fatal_handler(enum log_type type, int status,
const char *format, va_list args)
ATTR_NORETURN ATTR_FORMAT(3, 0);
@@ -52,7 +50,7 @@ static const char *get_log_stamp_format(
return log_stamp_format;
}
-static void failure_exit(int status)
+void failure_exit(int status)
{
if (failure_exit_callback != NULL)
failure_exit_callback(&status);
@@ -152,7 +150,7 @@ default_fatal_handler(enum log_type type
{
const char *backtrace;
- if (default_handler(log_type_prefixes[type], log_fd, format,
+ if (default_handler(failure_log_type_prefixes[type], log_fd, format,
args) < 0 && status == FATAL_DEFAULT)
status = FATAL_LOGWRITE;
@@ -172,7 +170,8 @@ default_error_handler(enum log_type type
{
int fd = type == LOG_TYPE_INFO ? log_info_fd : log_fd;
- if (default_handler(log_type_prefixes[type], fd, format, args) < 0)
+ if (default_handler(failure_log_type_prefixes[type],
+ fd, format, args) < 0)
failure_exit(FATAL_LOGWRITE);
}
diff -r 5e0f115665bf -r cc70ab74f4f3 src/lib/failures.h
--- a/src/lib/failures.h Sun Dec 23 16:31:54 2007 +0200
+++ b/src/lib/failures.h Thu Dec 27 22:51:28 2007 +0200
@@ -25,6 +25,8 @@ typedef void failure_callback_t(enum log
typedef void failure_callback_t(enum log_type type, const char *, va_list);
typedef void fatal_failure_callback_t(enum log_type type, int status,
const char *, va_list);
+
+extern const char *failure_log_type_prefixes[];
void i_log_type(enum log_type type, const char *format, ...) ATTR_FORMAT(2, 3);
@@ -75,6 +77,8 @@ void i_set_failure_timestamp_format(cons
/* Call the callback before exit()ing. The callback may update the status. */
void i_set_failure_exit_callback(void (*callback)(int *status));
+/* Call the exit callback and exit() */
+void failure_exit(int status) ATTR_NORETURN;
void failures_deinit(void);
More information about the dovecot-cvs
mailing list