summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 6ca3d2a)
raw | patch | inline | side by side (parent: 6ca3d2a)
author | octo <octo> | |
Sun, 18 Dec 2005 22:05:58 +0000 (22:05 +0000) | ||
committer | octo <octo> | |
Sun, 18 Dec 2005 22:05:58 +0000 (22:05 +0000) |
src/collectd.c | patch | blob | history |
diff --git a/src/collectd.c b/src/collectd.c
index 9794577512452b2346c22ff5d23ed317c5bcc16c..4fdfcf100df2ebc966ac32f778d3fab3b1ee151d 100644 (file)
--- a/src/collectd.c
+++ b/src/collectd.c
loop++;
}
+static void sigTermHandler (int signal)
+{
+ loop++;
+}
+
static int change_basedir (char *dir)
{
int dirlen = strlen (dir);
int main (int argc, char **argv)
{
- struct sigaction sigIntAction, sigChldAction;
+ struct sigaction sigIntAction;
+ struct sigaction sigTermAction;
#if COLLECT_DAEMON
+ struct sigaction sigChldAction;
pid_t pid;
#endif
}
/*
- * install signal handlers
+ * fork off child
*/
- sigIntAction.sa_handler = sigIntHandler;
- sigaction (SIGINT, &sigIntAction, NULL);
-
+#if COLLECT_DAEMON
sigChldAction.sa_handler = SIG_IGN;
sigaction (SIGCHLD, &sigChldAction, NULL);
- /*
- * fork off child
- */
-#if COLLECT_DAEMON
if (daemonize)
{
if ((pid = fork ()) == -1)
} /* if (daemonize) */
#endif /* COLLECT_DAEMON */
+ /*
+ * install signal handlers
+ */
+ sigIntAction.sa_handler = sigIntHandler;
+ sigaction (SIGINT, &sigIntAction, NULL);
+
+ sigIntAction.sa_handler = sigTermHandler;
+ sigaction (SIGTERM, &sigTermAction, NULL);
+
/*
* run the actual loops
*/