Skip to content

Commit

Permalink
lib: Add i_failure_handler_is_internal()
Browse files Browse the repository at this point in the history
  • Loading branch information
sirainen committed Apr 27, 2018
1 parent d0d7b0a commit 1b2edce
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/lib/failures.c
Expand Up @@ -735,6 +735,12 @@ void i_set_failure_internal(void)
i_set_debug_handler(i_internal_error_handler);
}

bool i_failure_handler_is_internal(failure_callback_t *const callback)
{
return callback == i_internal_fatal_handler ||
callback == i_internal_error_handler;
}

void i_set_failure_ignore_errors(bool ignore)
{
failure_ignore_errors = ignore;
Expand Down
3 changes: 3 additions & 0 deletions src/lib/failures.h
Expand Up @@ -103,6 +103,9 @@ void i_set_failure_file(const char *path, const char *prefix);

/* Send errors to stderr using internal error protocol. */
void i_set_failure_internal(void);
/* Returns TRUE if the given callback handler was set via
i_set_failure_internal(). */
bool i_failure_handler_is_internal(failure_callback_t *const callback);
/* If writing to log fails, ignore it instead of existing with
FATAL_LOGWRITE or FATAL_LOGERROR. */
void i_set_failure_ignore_errors(bool ignore);
Expand Down

0 comments on commit 1b2edce

Please sign in to comment.