Browse code

- Added code to start snmp agent before forking children

ric authored on 28/08/2002 19:00:08
Showing 1 changed files
... ...
@@ -460,6 +460,16 @@ int main_loop()
460 460
 {
461 461
 	int r, i;
462 462
 	pid_t pid;
463
+#ifdef WITH_SNMP_MOD
464
+	int (*snmp_start)();
465
+
466
+	/* initialize snmp module */
467
+	snmp_start = (int(*)())find_export("snmp_start", 0);
468
+	if(snmp_start)
469
+		if(snmp_start() == -1)
470
+			LOG(L_ERR, "ERROR: Couldn't start snmp agent\n");
471
+#endif
472
+		
463 473
 
464 474
 	/* one "main" process and n children handling i/o */
465 475
 
... ...
@@ -906,10 +916,7 @@ int main(int argc, char** argv)
906 906
 		goto error;
907 907
 	}
908 908
 
909
-#ifdef STATS
910
-	if (init_stats(  dont_fork ? 1 : children_no  )==-1) goto error;
911
-#endif
912
-	
909
+
913 910
 
914 911
 	print_rl();
915 912
 
... ...
@@ -1047,6 +1054,10 @@ int main(int argc, char** argv)
1047 1047
 		goto error;
1048 1048
 	};
1049 1049
 
1050
+#ifdef STATS
1051
+	if (init_stats(  dont_fork ? 1 : children_no  )==-1) goto error;
1052
+#endif
1053
+	
1050 1054
 	return main_loop();
1051 1055
 
1052 1056