Browse code

Initialization of the unixsock server moved before forking of UDP listeners because they need to inhert open unix sockets

Jan Janak authored on 08/03/2004 20:51:57
Showing 1 changed files
... ...
@@ -752,6 +752,7 @@ int main_loop()
752 752
 		/* process_no now initialized to zero -- increase from now on
753 753
 		   as new processes are forked (while skipping 0 reserved for main )
754 754
 		*/
755
+
755 756
 		for(si=udp_listen;si;si=si->next){
756 757
 			/* create the listening socket (for each address)*/
757 758
 			/* udp */
... ...
@@ -800,6 +801,15 @@ int main_loop()
800 801
 			/* all procs should have access to all the sockets (for sending)
801 802
 			 * so we open all first*/
802 803
 		if (do_suid()==-1) goto error; /* try to drop priviledges */
804
+
805
+		     /* Initialize Unix domain socket server before forking so that all
806
+		      * children inherit opened socket for sending and receiving
807
+		      */
808
+		if (init_unixsock_server()<0) {
809
+			LOG(L_ERR, "Error while initializing Unix domain socket server\n");
810
+			goto error;
811
+		}
812
+
803 813
 		/* udp processes */
804 814
 		for(si=udp_listen; si; si=si->next){
805 815
 			for(i=0;i<children_no;i++){
... ...
@@ -866,12 +876,6 @@ int main_loop()
866 876
 		goto error;
867 877
 	}
868 878
 
869
-	     /* Initialize Unix domain socket server */
870
-	if (init_unixsock_server()<0) {
871
-		LOG(L_ERR, "Error while initializing Unix domain socket server\n");
872
-		goto error;
873
-	}
874
-
875 879
 #ifdef USE_TCP
876 880
 	/* if we are using tcp we always need the timer */
877 881
 	if ((!tcp_disable)||(timer_list))