diff --git a/src/jrd/err.cpp b/src/jrd/err.cpp index 0dac5c897c..1ea169db9f 100644 --- a/src/jrd/err.cpp +++ b/src/jrd/err.cpp @@ -550,7 +550,7 @@ void ERR_punt(void) if (dbb && (dbb->dbb_flags & DBB_bugcheck)) { 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); if (Config::getBugcheckAbort()) { diff --git a/src/jrd/gds.cpp b/src/jrd/gds.cpp index 9398ff9b9d..f55a7d0e0d 100644 --- a/src/jrd/gds.cpp +++ b/src/jrd/gds.cpp @@ -1305,8 +1305,15 @@ void API_ROUTINE gds__log_status(const TEXT* database, TEXT* p = buffer; const TEXT* const end = p + BUFFER_XLARGE; - const int max_db_len = int(BUFFER_XLARGE - 12); - sprintf(p, "Database: %.*s", max_db_len, (database) ? database : ""); + if (database) + { + const int max_db_len = int(BUFFER_XLARGE - 12); + sprintf(p, "Database: %.*s", max_db_len, database); + } + else + { + *p = 0; + } do { while (*p) diff --git a/src/jrd/why.cpp b/src/jrd/why.cpp index bc344cb9f3..99418436a4 100644 --- a/src/jrd/why.cpp +++ b/src/jrd/why.cpp @@ -6093,13 +6093,21 @@ ISC_STATUS API_ROUTINE fb__shutdown(ISC_STATUS* user_status) if (ShutChain::run(FB_SHUT_PREPROVIDERS) == 0) { // Shutdown providers + ISC_STATUS* curStatus = status; + ISC_STATUS_ARRAY tempStatus; for (int n = 0; n < SUBSYSTEMS; ++n) { PTR entry = get_entrypoint(PROC_SHUTDOWN, n); if (entry != no_entrypoint) { - if (entry(status) != FB_SUCCESS) - break; + if (entry(curStatus) != FB_SUCCESS) + { + // Log error + gds__log("Error shutting down subsystem"); + gds__log_status(0, curStatus); + // Preserve first error, which happened + curStatus = tempStatus; + } } } diff --git a/src/remote/inet_server.cpp b/src/remote/inet_server.cpp index b5085f5d9c..ad49c3a412 100644 --- a/src/remote/inet_server.cpp +++ b/src/remote/inet_server.cpp @@ -526,7 +526,7 @@ static void shutdownInit() fb__shutdown_callback(status, shutdownInetServer, FB_SHUT_POSTPROVIDERS); if (status[0] == 1 && status[1] > 0) { - gds__log_status("shutdownInit", status); + gds__log_status("Error in shutdownInit()", status); isc_print_status(status); exit(STARTUP_ERROR); } diff --git a/src/remote/server.cpp b/src/remote/server.cpp index 5ac365f2e6..deb27196a7 100644 --- a/src/remote/server.cpp +++ b/src/remote/server.cpp @@ -3642,7 +3642,7 @@ static bool process_packet(rem_port* port, memset(local_status, 0, sizeof(local_status)); 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! */ port->send_response(sendL, 0, 0, local_status, false);