- memset (&sig_pipe_action, '\0', sizeof (sig_pipe_action));
- sig_pipe_action.sa_handler = SIG_IGN;
- sigaction (SIGPIPE, &sig_pipe_action, NULL);
-
- /*
- * install signal handlers
- */
- memset (&sig_int_action, '\0', sizeof (sig_int_action));
- sig_int_action.sa_handler = sig_int_handler;
- if (0 != sigaction (SIGINT, &sig_int_action, NULL)) {
- char errbuf[1024];
- ERROR ("Error: Failed to install a signal handler for signal INT: %s",
- sstrerror (errno, errbuf, sizeof (errbuf)));
- return (1);
- }
-
- memset (&sig_term_action, '\0', sizeof (sig_term_action));
- sig_term_action.sa_handler = sig_term_handler;
- if (0 != sigaction (SIGTERM, &sig_term_action, NULL)) {
- char errbuf[1024];
- ERROR ("Error: Failed to install a signal handler for signal TERM: %s",
- sstrerror (errno, errbuf, sizeof (errbuf)));
- return (1);
- }
-
- memset (&sig_usr1_action, '\0', sizeof (sig_usr1_action));
- sig_usr1_action.sa_handler = sig_usr1_handler;
- if (0 != sigaction (SIGUSR1, &sig_usr1_action, NULL)) {
- char errbuf[1024];
- ERROR ("Error: Failed to install a signal handler for signal USR1: %s",
- sstrerror (errno, errbuf, sizeof (errbuf)));
- return (1);
- }
-
- /*
- * run the actual loops
- */
- do_init ();
-
- if (test_readall)
- {
- if (plugin_read_all_once () != 0)
- exit_status = 1;
- }
- else
- {
- INFO ("Initialization complete, entering read-loop.");
- do_loop ();
- }
-
- /* close syslog */
- INFO ("Exiting normally.");
-
- do_shutdown ();
+ struct sigaction sig_pipe_action = {.sa_handler = SIG_IGN};
+
+ sigaction(SIGPIPE, &sig_pipe_action, NULL);
+
+ /*
+ * install signal handlers
+ */
+ struct sigaction sig_int_action = {.sa_handler = sig_int_handler};
+
+ if (0 != sigaction(SIGINT, &sig_int_action, NULL)) {
+ ERROR("Error: Failed to install a signal handler for signal INT: %s",
+ STRERRNO);
+ return 1;
+ }
+
+ struct sigaction sig_term_action = {.sa_handler = sig_term_handler};
+
+ if (0 != sigaction(SIGTERM, &sig_term_action, NULL)) {
+ ERROR("Error: Failed to install a signal handler for signal TERM: %s",
+ STRERRNO);
+ return 1;
+ }
+
+ struct sigaction sig_usr1_action = {.sa_handler = sig_usr1_handler};
+
+ if (0 != sigaction(SIGUSR1, &sig_usr1_action, NULL)) {
+ ERROR("Error: Failed to install a signal handler for signal USR1: %s",
+ STRERRNO);
+ return 1;
+ }
+
+ /*
+ * run the actual loops
+ */
+ if (do_init() != 0) {
+ ERROR("Error: one or more plugin init callbacks failed.");
+ exit_status = 1;
+ }
+
+ if (config.test_readall) {
+ if (plugin_read_all_once() != 0) {
+ ERROR("Error: one or more plugin read callbacks failed.");
+ exit_status = 1;
+ }
+ } else {
+ INFO("Initialization complete, entering read-loop.");
+ do_loop();
+ }
+
+ /* close syslog */
+ INFO("Exiting normally.");
+
+ if (do_shutdown() != 0) {
+ ERROR("Error: one or more plugin shutdown callbacks failed.");
+ exit_status = 1;
+ }