[sr-dev] git:5.1:96d4a012: core: main - use fprintf() if daemon_status_send() fails at shut down

Daniel-Constantin Mierla miconda at gmail.com
Tue Feb 27 11:05:12 CET 2018


Module: kamailio
Branch: 5.1
Commit: 96d4a01287945a58b3b7c8dfc06bd41acd00d213
URL: https://github.com/kamailio/kamailio/commit/96d4a01287945a58b3b7c8dfc06bd41acd00d213

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date: 2018-02-27T11:04:31+01:00

core: main - use fprintf() if daemon_status_send() fails at shut down

- avoid race with syslog() when processes are killed
- reported by GH #1454

(cherry picked from commit 54774017325fe2e24ee7c5d64b343ad0097c8332)

---

Modified: src/main.c

---

Diff:  https://github.com/kamailio/kamailio/commit/96d4a01287945a58b3b7c8dfc06bd41acd00d213.diff
Patch: https://github.com/kamailio/kamailio/commit/96d4a01287945a58b3b7c8dfc06bd41acd00d213.patch

---

diff --git a/src/main.c b/src/main.c
index 83d63bcfc1..9366884ac7 100644
--- a/src/main.c
+++ b/src/main.c
@@ -2633,8 +2633,7 @@ int main(int argc, char** argv)
 
 	/* fix routing lists */
 	if ( (r=fix_rls())!=0){
-		fprintf(stderr, "ERROR: error %d while trying to fix configuration\n",
-						r);
+		fprintf(stderr, "error %d while trying to fix configuration\n", r);
 		goto error;
 	};
 	fixup_complete=1;
@@ -2650,7 +2649,7 @@ int main(int argc, char** argv)
 	if (is_main) shutdown_children(SIGTERM, 0);
 	if (!dont_daemonize) {
 		if (daemon_status_send(0) < 0)
-			ERR("error sending exit status: %s [%d]\n",
+			fprintf(stderr, "error sending exit status: %s [%d]\n",
 					strerror(errno), errno);
 	}
 	/* else terminate process */
@@ -2661,7 +2660,7 @@ int main(int argc, char** argv)
 	if (is_main) shutdown_children(SIGTERM, 0);
 	if (!dont_daemonize) {
 		if (daemon_status_send((char)-1) < 0)
-			ERR("error sending exit status: %s [%d]\n",
+			fprintf(stderr, "error sending exit status: %s [%d]\n",
 					strerror(errno), errno);
 	}
 	return -1;




More information about the sr-dev mailing list