8
0
mirror of https://github.com/FirebirdSQL/firebird.git synced 2025-01-23 22:43:04 +01:00

1. Make use of gds__log_status() more consustent (no Database: line in log when database is not specified).

2. A bit better logic when error happens during provider shutdown.
This commit is contained in:
alexpeshkoff 2008-03-03 13:59:09 +00:00
parent 33a1fa74f4
commit 58f8675e57
5 changed files with 22 additions and 7 deletions

View File

@ -550,7 +550,7 @@ void ERR_punt(void)
if (dbb && (dbb->dbb_flags & DBB_bugcheck)) if (dbb && (dbb->dbb_flags & DBB_bugcheck))
{ {
gds__log_status(tdbb->getAttachment()->att_filename.hasData() ? gds__log_status(tdbb->getAttachment()->att_filename.hasData() ?
tdbb->getAttachment()->att_filename.c_str() : "Database unknown in ERR_punt on bugcheck", tdbb->getAttachment()->att_filename.c_str() : NULL,
tdbb->tdbb_status_vector); tdbb->tdbb_status_vector);
if (Config::getBugcheckAbort()) if (Config::getBugcheckAbort())
{ {

View File

@ -1305,8 +1305,15 @@ void API_ROUTINE gds__log_status(const TEXT* database,
TEXT* p = buffer; TEXT* p = buffer;
const TEXT* const end = p + BUFFER_XLARGE; const TEXT* const end = p + BUFFER_XLARGE;
if (database)
{
const int max_db_len = int(BUFFER_XLARGE - 12); const int max_db_len = int(BUFFER_XLARGE - 12);
sprintf(p, "Database: %.*s", max_db_len, (database) ? database : ""); sprintf(p, "Database: %.*s", max_db_len, database);
}
else
{
*p = 0;
}
do { do {
while (*p) while (*p)

View File

@ -6093,13 +6093,21 @@ ISC_STATUS API_ROUTINE fb__shutdown(ISC_STATUS* user_status)
if (ShutChain::run(FB_SHUT_PREPROVIDERS) == 0) if (ShutChain::run(FB_SHUT_PREPROVIDERS) == 0)
{ {
// Shutdown providers // Shutdown providers
ISC_STATUS* curStatus = status;
ISC_STATUS_ARRAY tempStatus;
for (int n = 0; n < SUBSYSTEMS; ++n) for (int n = 0; n < SUBSYSTEMS; ++n)
{ {
PTR entry = get_entrypoint(PROC_SHUTDOWN, n); PTR entry = get_entrypoint(PROC_SHUTDOWN, n);
if (entry != no_entrypoint) if (entry != no_entrypoint)
{ {
if (entry(status) != FB_SUCCESS) if (entry(curStatus) != FB_SUCCESS)
break; {
// Log error
gds__log("Error shutting down subsystem");
gds__log_status(0, curStatus);
// Preserve first error, which happened
curStatus = tempStatus;
}
} }
} }

View File

@ -526,7 +526,7 @@ static void shutdownInit()
fb__shutdown_callback(status, shutdownInetServer, FB_SHUT_POSTPROVIDERS); fb__shutdown_callback(status, shutdownInetServer, FB_SHUT_POSTPROVIDERS);
if (status[0] == 1 && status[1] > 0) if (status[0] == 1 && status[1] > 0)
{ {
gds__log_status("shutdownInit", status); gds__log_status("Error in shutdownInit()", status);
isc_print_status(status); isc_print_status(status);
exit(STARTUP_ERROR); exit(STARTUP_ERROR);
} }

View File

@ -3642,7 +3642,7 @@ static bool process_packet(rem_port* port,
memset(local_status, 0, sizeof(local_status)); memset(local_status, 0, sizeof(local_status));
Firebird::stuff_exception(local_status, ex); Firebird::stuff_exception(local_status, ex);
gds__log_status("unknown, SERVER/process_packet", local_status); gds__log_status(0, local_status);
/* It would be nice to log an error to the user, instead of just terminating them! */ /* It would be nice to log an error to the user, instead of just terminating them! */
port->send_response(sendL, 0, 0, local_status, false); port->send_response(sendL, 0, 0, local_status, false);