summaryrefslogtreecommitdiffstats
path: root/src/main.c
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-03 15:51:48 +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-03 15:51:48 +0000
commitc41a0d3efc957505e72067e99a873ce66be0834a (patch)
tree31202265c1acd117df130ef0e9b466a005e8cabe /src/main.c
parentd6978c9faadf9552bcb522d56d40c8aefa2e503e (diff)
o add support for connection logging to the statistics mode via Logfile
o minor irrelevant fixes for uncommon error paths and fix several typos o use LOG_INFO for connection logging, use LOG_NOTICE for other information o minor error handling updates
Diffstat (limited to 'src/main.c')
-rw-r--r--src/main.c14
1 files changed, 6 insertions, 8 deletions
diff --git a/src/main.c b/src/main.c
index 3a54911..e0ca46d 100644
--- a/src/main.c
+++ b/src/main.c
@@ -246,8 +246,7 @@ int main(int argc, char *argv[])
/*
* Setting up logging
*/
- STATE(log) = init_log(CONFIG(logfile));
- if (config_set && !STATE(log)) {
+ if (config_set && init_log() == -1) {
fprintf(stderr, "can't open logfile `%s\n'", CONFIG(logfile));
exit(EXIT_FAILURE);
}
@@ -255,7 +254,7 @@ int main(int argc, char *argv[])
if (type == REQUEST) {
if (do_local_request(action, &conf.local, local_step) == -1) {
fprintf(stderr, "can't connect: is conntrackd "
- "running? appropiate permissions?\n");
+ "running? appropriate permissions?\n");
exit(EXIT_FAILURE);
}
exit(EXIT_SUCCESS);
@@ -276,22 +275,21 @@ int main(int argc, char *argv[])
pid_t pid;
if ((pid = fork()) == -1) {
- dlog(STATE(log), LOG_ERR, "fork() failed: "
- "%s", strerror(errno));
+ perror("fork has failed: ");
exit(EXIT_FAILURE);
} else if (pid)
exit(EXIT_SUCCESS);
- dlog(STATE(log), LOG_INFO, "--- starting in daemon mode ---");
+ dlog(STATE(log), LOG_NOTICE, "-- starting in daemon mode --");
} else
- dlog(STATE(log), LOG_INFO, "--- starting in console mode ---");
+ dlog(STATE(log), LOG_NOTICE, "-- starting in console mode --");
/*
* initialization process
*/
if (init(mode) == -1) {
- close_log(STATE(log));
+ close_log();
fprintf(stderr, "ERROR: conntrackd cannot start, please "
"check the logfile for more info\n");
unlink(CONFIG(lockfile));