Main: move log_deinit() call to mpd_main()
Deinitialize the logging library after the last exception handler, because that one could still need it. Use `AtScopeExit()` to ensure it's always called, even if an exception was thrown.
This commit is contained in:
@@ -59,6 +59,7 @@
|
|||||||
#include "config/Option.hxx"
|
#include "config/Option.hxx"
|
||||||
#include "config/Domain.hxx"
|
#include "config/Domain.hxx"
|
||||||
#include "util/RuntimeError.hxx"
|
#include "util/RuntimeError.hxx"
|
||||||
|
#include "util/ScopeExit.hxx"
|
||||||
|
|
||||||
#ifdef ENABLE_DAEMON
|
#ifdef ENABLE_DAEMON
|
||||||
#include "unix/Daemon.hxx"
|
#include "unix/Daemon.hxx"
|
||||||
@@ -534,6 +535,8 @@ static inline
|
|||||||
#endif
|
#endif
|
||||||
int mpd_main(int argc, char *argv[])
|
int mpd_main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
|
AtScopeExit() { log_deinit(); };
|
||||||
|
|
||||||
try {
|
try {
|
||||||
return MainOrThrow(argc, argv);
|
return MainOrThrow(argc, argv);
|
||||||
} catch (const std::exception &e) {
|
} catch (const std::exception &e) {
|
||||||
@@ -717,8 +720,6 @@ try {
|
|||||||
|
|
||||||
IcuFinish();
|
IcuFinish();
|
||||||
|
|
||||||
log_deinit();
|
|
||||||
|
|
||||||
return EXIT_SUCCESS;
|
return EXIT_SUCCESS;
|
||||||
} catch (const std::exception &e) {
|
} catch (const std::exception &e) {
|
||||||
LogError(e);
|
LogError(e);
|
||||||
|
Reference in New Issue
Block a user