Commit 6ffbb151 authored by Max Kellermann's avatar Max Kellermann

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.
parent 271e49db
......@@ -59,6 +59,7 @@
#include "config/Option.hxx"
#include "config/Domain.hxx"
#include "util/RuntimeError.hxx"
#include "util/ScopeExit.hxx"
#ifdef ENABLE_DAEMON
#include "unix/Daemon.hxx"
......@@ -534,6 +535,8 @@ static inline
#endif
int mpd_main(int argc, char *argv[])
{
AtScopeExit() { log_deinit(); };
try {
return MainOrThrow(argc, argv);
} catch (const std::exception &e) {
......@@ -717,8 +720,6 @@ try {
IcuFinish();
log_deinit();
return EXIT_SUCCESS;
} catch (const std::exception &e) {
LogError(e);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment