From d6a34717bfcaf652a7500c53c4cd1995a49370de Mon Sep 17 00:00:00 2001 From: Michael Carlberg Date: Tue, 24 Jan 2017 02:14:19 +0100 Subject: [PATCH] fix(ipc): Remove existing fifo file --- src/components/ipc.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/components/ipc.cpp b/src/components/ipc.cpp index 51a151d1..4e918ce9 100644 --- a/src/components/ipc.cpp +++ b/src/components/ipc.cpp @@ -24,6 +24,9 @@ ipc::make_type ipc::make() { ipc::ipc(signal_emitter& emitter, const logger& logger) : m_sig(emitter), m_log(logger) { m_path = string_util::replace(PATH_MESSAGING_FIFO, "%pid%", to_string(getpid())); + if (file_util::exists(m_path) && unlink(m_path.c_str()) == -1) { + throw system_error("Failed to remove ipc channel"); + } if (mkfifo(m_path.c_str(), 0666) == -1) { throw system_error("Failed to create ipc channel"); }