summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
author/C=EU/ST=EU/CN=Pablo Neira Ayuso/emailAddress=pablo@netfilter.org </C=EU/ST=EU/CN=Pablo Neira Ayuso/emailAddress=pablo@netfilter.org>2008-01-07 16:32:10 +0000
committer/C=EU/ST=EU/CN=Pablo Neira Ayuso/emailAddress=pablo@netfilter.org </C=EU/ST=EU/CN=Pablo Neira Ayuso/emailAddress=pablo@netfilter.org>2008-01-07 16:32:10 +0000
commit6023de67c84e531939b77454783835c65f694bff (patch)
tree8011b6c6cd39a19dabef363a4d37259cebf353d6 /src
parentcee8b90c3e93e9759ad559d55fc75fe9f7f11452 (diff)
downloadconntrack-tools-6023de67c84e531939b77454783835c65f694bff.tar.gz
conntrack-tools-6023de67c84e531939b77454783835c65f694bff.zip
fix segfaul in the exit path for the statistics mode (introduced in r7175)
Diffstat (limited to 'src')
-rw-r--r--src/log.c3
-rw-r--r--src/run.c2
-rw-r--r--src/stats-mode.c8
3 files changed, 8 insertions, 5 deletions
diff --git a/src/log.c b/src/log.c
index 176bdcd..51109b6 100644
--- a/src/log.c
+++ b/src/log.c
@@ -171,6 +171,7 @@ void close_log(void)
if (STATE(stats_log) != NULL)
fclose(STATE(stats_log));
- if (CONFIG(syslog_facility) != -1)
+ if (CONFIG(syslog_facility) != -1 ||
+ CONFIG(stats).syslog_facility != -1)
closelog();
}
diff --git a/src/run.c b/src/run.c
index ebf4b3c..609b454 100644
--- a/src/run.c
+++ b/src/run.c
@@ -41,7 +41,7 @@ void killer(int foo)
destroy_alarm_scheduler();
unlink(CONFIG(lockfile));
dlog(STATE(log), LOG_NOTICE, "---- shutdown received ----");
- close_log(STATE(log));
+ close_log();
sigprocmask(SIG_UNBLOCK, &STATE(block), NULL);
diff --git a/src/stats-mode.c b/src/stats-mode.c
index 05a1b2c..ee9b3fd 100644
--- a/src/stats-mode.c
+++ b/src/stats-mode.c
@@ -60,9 +60,11 @@ static int init_stats(void)
static void kill_stats()
{
cache_destroy(STATE_STATS(cache));
- buffer_flush(STATE_STATS(buffer_log),
- dlog_buffered_ct_flush,
- STATE(stats_log));
+ /* flush the buffer before exiting */
+ if (STATE(stats_log) != NULL)
+ buffer_flush(STATE(stats_log),
+ dlog_buffered_ct_flush,
+ STATE(stats_log));
}
/* handler for requests coming via UNIX socket */