diff --git a/src/ipc/util.cpp b/src/ipc/util.cpp index 8dc9d74e..b93cd36e 100644 --- a/src/ipc/util.cpp +++ b/src/ipc/util.cpp @@ -20,7 +20,10 @@ namespace ipc { string ensure_runtime_path() { string runtime_path = get_runtime_path(); if (!file_util::exists(runtime_path) && mkdir(runtime_path.c_str(), 0700) == -1) { - throw system_error("Failed to create ipc socket folders"); + // It's possible the folder was created in the meantime, we have to check again. + if (!file_util::exists(runtime_path)) { + throw system_error("Failed to create ipc socket folders"); + } } return runtime_path; diff --git a/src/main.cpp b/src/main.cpp index a5286f0b..b7929683 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -148,7 +148,12 @@ int main(int argc, char** argv) { unique_ptr ipc{}; if (conf.get(conf.section(), "enable-ipc", false)) { - ipc = ipc::ipc::make(loop); + try { + ipc = ipc::ipc::make(loop); + } catch (const std::exception& e) { + ipc.reset(); + logger.err("Disabling IPC channels due to error: %s", e.what()); + } } auto ctrl = controller::make((bool)ipc, loop);