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 800
 			/* all procs should have access to all the sockets (for sending)
801 801
 			 * so we open all first*/
802 802
 		if (do_suid()==-1) goto error; /* try to drop priviledges */
803
+
804
+		     /* Initialize Unix domain socket server before forking so that all
805
+		      * children inherit opened socket for sending and receiving
806
+		      */
807
+		if (init_unixsock_server()<0) {
808
+			LOG(L_ERR, "Error while initializing Unix domain socket server\n");
809
+			goto error;
810
+		}
811
+
803 812
 		/* udp processes */
804 813
 		for(si=udp_listen; si; si=si->next){
805 814
 			for(i=0;i<children_no;i++){
... ...
@@ -866,12 +876,6 @@ int main_loop()
866 866
 		goto error;
867 867
 	}
868 868
 
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 869
 #ifdef USE_TCP
876 870
 	/* if we are using tcp we always need the timer */
877 871
 	if ((!tcp_disable)||(timer_list))