[sr-dev] git:5.0:077503d9: core: main - use fprintf() if daemon_status_send() fails at shut down

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


Module: kamailio
Branch: 5.0
Commit: 077503d92d27bc3f280e1fe37d040f55bce7d50e
URL: https://github.com/kamailio/kamailio/commit/077503d92d27bc3f280e1fe37d040f55bce7d50e

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date: 2018-02-27T11:05:38+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)
(cherry picked from commit 96d4a01287945a58b3b7c8dfc06bd41acd00d213)

---

Modified: src/main.c

---

Diff:  https://github.com/kamailio/kamailio/commit/077503d92d27bc3f280e1fe37d040f55bce7d50e.diff
Patch: https://github.com/kamailio/kamailio/commit/077503d92d27bc3f280e1fe37d040f55bce7d50e.patch

---

diff --git a/src/main.c b/src/main.c
index d0a2fb81ec..36258a10fb 100644
--- a/src/main.c
+++ b/src/main.c
@@ -2630,8 +2630,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;
@@ -2647,7 +2646,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 */
@@ -2658,7 +2657,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