From fbfefcc0a3ad0f4454c68127e22a2dce7450088d Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Mon, 6 Aug 2018 10:47:06 +0200 Subject: [PATCH] Main: call daemonize_finish() with AtScopeExit() --- src/Main.cxx | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/Main.cxx b/src/Main.cxx index 41a34c0ee..a5e8d70a3 100644 --- a/src/Main.cxx +++ b/src/Main.cxx @@ -526,6 +526,7 @@ MainOrThrow(int argc, char *argv[]) #ifdef ENABLE_DAEMON daemonize_set_user(); daemonize_begin(options.daemon); + AtScopeExit() { daemonize_finish(); }; #endif return mpd_main_after_fork(raw_config, config); @@ -715,10 +716,6 @@ mpd_main_after_fork(const ConfigData &raw_config, const Config &config) delete instance; instance = nullptr; -#ifdef ENABLE_DAEMON - daemonize_finish(); -#endif - return EXIT_SUCCESS; }