{
pid_t child;
int status;
+ char *base_dir;
+
+ /* These structures are static, because `sigaction' behaves weird if the are
+ * overwritten.. */
+ static struct sigaction sa_int;
+ static struct sigaction sa_term;
+ static struct sigaction sa_pipe;
child = fork ();
if (child < 0)
dup (0);
dup (0);
- {
- struct sigaction sa;
-
- memset (&sa, 0, sizeof (sa));
- sa.sa_handler = sig_int_handler;
- sigaction (SIGINT, &sa, NULL);
+ /* Install signal handlers */
+ memset (&sa_int, 0, sizeof (sa_int));
+ sa_int.sa_handler = sig_int_handler;
+ sigaction (SIGINT, &sa_int, NULL);
- memset (&sa, 0, sizeof (sa));
- sa.sa_handler = sig_term_handler;
- sigaction (SIGINT, &sa, NULL);
+ memset (&sa_term, 0, sizeof (sa_term));
+ sa_term.sa_handler = sig_term_handler;
+ sigaction (SIGINT, &sa_term, NULL);
- memset (&sa, 0, sizeof (sa));
- sa.sa_handler = SIG_IGN;
- sigaction (SIGPIPE, &sa, NULL);
- }
+ memset (&sa_pipe, 0, sizeof (sa_pipe));
+ sa_pipe.sa_handler = SIG_IGN;
+ sigaction (SIGPIPE, &sa_pipe, NULL);
openlog ("rrdcached", LOG_PID, LOG_DAEMON);