From 6c51b884acaaff4731de9741f33ceb023a72e890 Mon Sep 17 00:00:00 2001 From: Andrew Pogrebennyk Date: Wed, 28 Nov 2018 11:41:44 +0100 Subject: [PATCH] TT#34704 Fix sems to write pid file when running with -E option Change-Id: I530d6684c631b4f5e4d825a30f814517b1858717 (cherry picked from commit ae34e870c85009eacb3a4ac8aa37c00083892811) --- debian/patches/series | 1 + ...s-and-sems-pbx-to-write-pid-file-whe.patch | 66 +++++++++++++++++++ 2 files changed, 67 insertions(+) create mode 100644 debian/patches/sipwise/0001-TT-34704-Fix-sems-and-sems-pbx-to-write-pid-file-whe.patch diff --git a/debian/patches/series b/debian/patches/series index f9d905d3..8ff011d1 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -30,3 +30,4 @@ sipwise/0020-TT-9521-fix-200OK-without-SPD.patch sipwise/usage-reporting.patch sipwise/session_timers sipwise/introduce_forcesdp_from_pbx.patch +sipwise/0001-TT-34704-Fix-sems-and-sems-pbx-to-write-pid-file-whe.patch diff --git a/debian/patches/sipwise/0001-TT-34704-Fix-sems-and-sems-pbx-to-write-pid-file-whe.patch b/debian/patches/sipwise/0001-TT-34704-Fix-sems-and-sems-pbx-to-write-pid-file-whe.patch new file mode 100644 index 00000000..975aa790 --- /dev/null +++ b/debian/patches/sipwise/0001-TT-34704-Fix-sems-and-sems-pbx-to-write-pid-file-whe.patch @@ -0,0 +1,66 @@ +From 12ea81babb899cd637426afd13740dc9729ca8d3 Mon Sep 17 00:00:00 2001 +From: Roman Romanchenko +Date: Mon, 26 Mar 2018 12:47:33 +0300 +Subject: [PATCH] TT#34704 Fix sems and sems-pbx to write pid file when running + with -E option + + - now pid file written with -E as well +--- + core/sems.cpp | 15 +++++++-------- + 1 file changed, 7 insertions(+), 8 deletions(-) + +diff --git a/core/sems.cpp b/core/sems.cpp +index 6f03e5cd..a1814d32 100644 +--- a/core/sems.cpp ++++ b/core/sems.cpp +@@ -207,11 +207,11 @@ static bool apply_args(std::map& args) + AmConfig::PlugInPath = it->second; + break; + +-#ifndef DISABLE_DAEMON_MODE + case 'P': + AmConfig::DaemonPidFile = it->second; + break; + ++#ifndef DISABLE_DAEMON_MODE + case 'u': + AmConfig::DaemonUid = it->second; + break; +@@ -535,10 +535,6 @@ int main(int argc, char* argv[]) + DBG("I'm out. pid: %d", main_pid); + return 0; + } +- +- if(write_pid_file()<0) { +- goto error; +- } + + #ifdef PROPAGATE_COREDUMP_SETTINGS + if (have_limit) { +@@ -566,6 +562,10 @@ int main(int argc, char* argv[]) + }; + } + ++ if(write_pid_file()<0) { ++ goto error; ++ } ++ + #endif /* DISABLE_DAEMON_MODE */ + + main_pid = getpid(); +@@ -661,10 +661,9 @@ int main(int argc, char* argv[]) + async_file_writer::instance()->stop(); + async_file_writer::instance()->join(); + ++ unlink(AmConfig::DaemonPidFile.c_str()); ++ + #ifndef DISABLE_DAEMON_MODE +- if (AmConfig::DaemonMode) { +- unlink(AmConfig::DaemonPidFile.c_str()); +- } + if(fd[1]){ + main_pid = -1; + DBG("send -1 to parent\n"); +-- +2.17.1 +