projects
/
rrdtool.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
ee3699d
)
src/rrd_daemon.c: Use static structs for the signal handler configuration.
author
Florian Forster
<octo@leeloo.home.verplant.org>
Sun, 29 Jun 2008 14:16:50 +0000
(16:16 +0200)
committer
Florian Forster
<octo@leeloo.home.verplant.org>
Sun, 29 Jun 2008 14:16:50 +0000
(16:16 +0200)
src/rrd_daemon.c
patch
|
blob
|
history
diff --git
a/src/rrd_daemon.c
b/src/rrd_daemon.c
index
ac26a27
..
87ac8e9
100644
(file)
--- a/
src/rrd_daemon.c
+++ b/
src/rrd_daemon.c
@@
-1085,6
+1085,13
@@
static int daemonize (void) /* {{{ */
{
pid_t child;
int status;
{
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)
child = fork ();
if (child < 0)
@@
-1120,21
+1127,18
@@
static int daemonize (void) /* {{{ */
dup (0);
dup (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);
openlog ("rrdcached", LOG_PID, LOG_DAEMON);