From 271e49db5d2d85ad1ee7deb7cd1b3d69d4dc2f3e Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Wed, 1 Aug 2018 20:13:27 +0200 Subject: [PATCH] Main: move code to MainOrThrow(), leaving exception handler in mpd_main() --- src/Main.cxx | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/src/Main.cxx b/src/Main.cxx index 9ab6c14c5..009ed9a00 100644 --- a/src/Main.cxx +++ b/src/Main.cxx @@ -446,11 +446,9 @@ int main(int argc, char *argv[]) static int mpd_main_after_fork(const ConfigData &raw_config, const Config &config); -#ifdef ANDROID -static inline -#endif -int mpd_main(int argc, char *argv[]) -try { +static inline int +MainOrThrow(int argc, char *argv[]) +{ struct options options; #ifdef ENABLE_DAEMON @@ -529,10 +527,19 @@ try { #endif return mpd_main_after_fork(raw_config, config); +} -} catch (const std::exception &e) { - LogError(e); - return EXIT_FAILURE; +#ifdef ANDROID +static inline +#endif +int mpd_main(int argc, char *argv[]) +{ + try { + return MainOrThrow(argc, argv); + } catch (const std::exception &e) { + LogError(e); + return EXIT_FAILURE; + } } static int