TT#34704 Fix sems to write pid file when running with -E option

Change-Id: I530d6684c631b4f5e4d825a30f814517b1858717
(cherry picked from commit ae34e870c8)
mr6.5.3
Andrew Pogrebennyk 8 years ago
parent a1362f92da
commit 6c51b884ac

@ -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

@ -0,0 +1,66 @@
From 12ea81babb899cd637426afd13740dc9729ca8d3 Mon Sep 17 00:00:00 2001
From: Roman Romanchenko <rromanchenko@sipwise.com>
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<char,string>& 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
Loading…
Cancel
Save