Main: call daemonize_finish() with AtScopeExit()

This commit is contained in:
Max Kellermann 2018-08-06 10:47:06 +02:00
parent b4c517c501
commit fbfefcc0a3

View File

@ -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;
}