Some improvements and fixes to previously submitted pull request for cleaning temporary objects
This commit is contained in:
@ -64,7 +64,7 @@ static void on_before_exec(pgutConn *conn);
|
||||
static void on_after_exec(pgutConn *conn);
|
||||
static void on_interrupt(void);
|
||||
static void on_cleanup(void);
|
||||
static void exit_or_abort(int exitcode);
|
||||
static void exit_or_abort(int exitcode, int elevel);
|
||||
|
||||
void
|
||||
pgut_init(int argc, char **argv)
|
||||
@ -872,7 +872,10 @@ pgut_errfinish(int dummy, ...)
|
||||
edata->detail.data);
|
||||
|
||||
if (pgut_abort_level <= edata->elevel && edata->elevel <= PANIC)
|
||||
exit_or_abort(edata->code);
|
||||
{
|
||||
in_cleanup = true; /* need to be set for cleaning temporary objects on error */
|
||||
exit_or_abort(edata->code, edata->elevel);
|
||||
}
|
||||
}
|
||||
|
||||
#ifndef PGUT_OVERRIDE_ELOG
|
||||
@ -1195,13 +1198,19 @@ on_cleanup(void)
|
||||
}
|
||||
|
||||
static void
|
||||
exit_or_abort(int exitcode)
|
||||
exit_or_abort(int exitcode, int elevel)
|
||||
{
|
||||
call_atexit_callbacks(true);
|
||||
if (in_cleanup)
|
||||
|
||||
if (in_cleanup && FATAL > elevel)
|
||||
{
|
||||
/* oops, error in cleanup*/
|
||||
in_cleanup = false;
|
||||
call_atexit_callbacks(true);
|
||||
exit(exitcode);
|
||||
}
|
||||
else if (FATAL <= elevel <= PANIC)
|
||||
{
|
||||
/* on FATAL or PANIC */
|
||||
call_atexit_callbacks(true);
|
||||
abort();
|
||||
}
|
||||
else
|
||||
|
Reference in New Issue
Block a user