/* * __handler_failure -- * Report the failure of an application-configured event handler. */ static void __handler_failure(WT_SESSION_IMPL *session, int error, const char *which, int error_handler_failed) { WT_EVENT_HANDLER *handler; WT_SESSION *wt_session; /* * !!! * SECURITY: * Buffer placed at the end of the stack in case snprintf overflows. */ char s[256]; (void)snprintf(s, sizeof(s), "application %s event handler failed: %s", which, wiredtiger_strerror(error)); /* * Use the error handler to report the failure, unless it was the error * handler that failed. If it was the error handler that failed, or a * call to the error handler fails, use the default error handler. */ wt_session = (WT_SESSION *)session; handler = session->event_handler; if (!error_handler_failed && handler->handle_error != __handle_error_default && handler->handle_error(handler, wt_session, error, s) == 0) return; (void)__handle_error_default(NULL, wt_session, error, s); }
/* * __handler_failure -- * Report the failure of an application-configured event handler. */ static void __handler_failure(WT_SESSION_IMPL *session, int error, const char *which, bool error_handler_failed) { WT_EVENT_HANDLER *handler; WT_SESSION *wt_session; /* * !!! * SECURITY: * Buffer placed at the end of the stack in case snprintf overflows. */ char s[256]; if (__wt_snprintf(s, sizeof(s), "application %s event handler failed: %s", which, __wt_strerror(session, error, NULL, 0)) != 0) return; /* * Use the error handler to report the failure, unless it was the error * handler that failed. If it was the error handler that failed, or a * call to the error handler fails, use the default error handler. */ wt_session = (WT_SESSION *)session; handler = session->event_handler; if (!error_handler_failed && handler->handle_error != __handle_error_default && handler->handle_error(handler, wt_session, error, s) == 0) return; /* * In case there is a failure in the default error handler, make sure * we don't recursively try to report *that* error. */ session->event_handler = &__event_handler_default; (void)__handle_error_default(NULL, wt_session, error, s); session->event_handler = handler; }