Browse code

- kill all children on error

Andrei Pelinescu-Onciul authored on 18/09/2002 12:02:21
Showing 1 changed files
... ...
@@ -384,7 +384,7 @@ void handle_sigs()
384 384
 			if (sig_flag==SIGINT)
385 385
 				DBG("INT received, program terminates\n");
386 386
 			else if (sig_flag==SIGPIPE)
387
-				DBG("SIGPIPE rreceived, program terminates\n");
387
+				DBG("SIGPIPE received, program terminates\n");
388 388
 			else
389 389
 				DBG("SIGTERM received, program terminates\n");
390 390
 				
... ...
@@ -836,8 +836,13 @@ int main(int argc, char** argv)
836 836
 	struct utsname myname;
837 837
 	char *options;
838 838
 	char port_no_str[MAX_PORT_LEN];
839
-	int port_no_str_len=0;
839
+	int port_no_str_len;
840
+	int ret;
840 841
 
842
+	/*init*/
843
+	port_no_str_len=0;
844
+	ret=-1;
845
+	
841 846
 	/* added by jku: add exit handler */
842 847
 	if (signal(SIGINT, sig_usr) == SIG_ERR ) {
843 848
 		DPrint("ERROR: no SIGINT signal handler can be installed\n");
... ...
@@ -1280,10 +1285,14 @@ int main(int argc, char** argv)
1280 1280
 	if (init_stats(  dont_fork ? 1 : children_no  )==-1) goto error;
1281 1281
 #endif
1282 1282
 	
1283
-	return main_loop();
1284
-
1283
+	ret=main_loop();
1284
+	/*kill everything*/
1285
+	kill(0, SIGTERM);
1286
+	return ret;
1285 1287
 
1286 1288
 error:
1289
+	/*kill everything*/
1290
+	kill(0, SIGTERM);
1287 1291
 	return -1;
1288 1292
 
1289 1293
 }