Browse code

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)

Daniel-Constantin Mierla authored on 27/02/2018 10:01:23
Showing 1 changed files
... ...
@@ -2630,8 +2630,7 @@ try_again:
2630 2630
 
2631 2631
 	/* fix routing lists */
2632 2632
 	if ( (r=fix_rls())!=0){
2633
-		fprintf(stderr, "ERROR: error %d while trying to fix configuration\n",
2634
-						r);
2633
+		fprintf(stderr, "error %d while trying to fix configuration\n", r);
2635 2634
 		goto error;
2636 2635
 	};
2637 2636
 	fixup_complete=1;
... ...
@@ -2647,7 +2646,7 @@ try_again:
2647 2646
 	if (is_main) shutdown_children(SIGTERM, 0);
2648 2647
 	if (!dont_daemonize) {
2649 2648
 		if (daemon_status_send(0) < 0)
2650
-			ERR("error sending exit status: %s [%d]\n",
2649
+			fprintf(stderr, "error sending exit status: %s [%d]\n",
2651 2650
 					strerror(errno), errno);
2652 2651
 	}
2653 2652
 	/* else terminate process */
... ...
@@ -2658,7 +2657,7 @@ error:
2658 2657
 	if (is_main) shutdown_children(SIGTERM, 0);
2659 2658
 	if (!dont_daemonize) {
2660 2659
 		if (daemon_status_send((char)-1) < 0)
2661
-			ERR("error sending exit status: %s [%d]\n",
2660
+			fprintf(stderr, "error sending exit status: %s [%d]\n",
2662 2661
 					strerror(errno), errno);
2663 2662
 	}
2664 2663
 	return -1;