From 1bbe9896f66702c0446319bfca39551952a85eb2 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Wed, 13 Oct 2021 18:55:02 +0200 Subject: [PATCH] Main: make inotify errors non-fatal --- src/Main.cxx | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/src/Main.cxx b/src/Main.cxx index 34eb743e0..f9c12f552 100644 --- a/src/Main.cxx +++ b/src/Main.cxx @@ -523,13 +523,18 @@ MainConfigured(const struct options &options, const ConfigData &raw_config) if (raw_config.GetBool(ConfigOption::AUTO_UPDATE, false)) { #ifdef ENABLE_INOTIFY if (instance.storage != nullptr && - instance.update != nullptr) - instance.inotify_update = - mpd_inotify_init(instance.event_loop, - *instance.storage, - *instance.update, - raw_config.GetUnsigned(ConfigOption::AUTO_UPDATE_DEPTH, - INT_MAX)); + instance.update != nullptr) { + try { + instance.inotify_update = + mpd_inotify_init(instance.event_loop, + *instance.storage, + *instance.update, + raw_config.GetUnsigned(ConfigOption::AUTO_UPDATE_DEPTH, + INT_MAX)); + } catch (...) { + LogError(std::current_exception()); + } + } #else LogWarning(config_domain, "inotify: auto_update was disabled. enable during compilation phase");