diff options
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-02-03 11:39:34 +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-02-03 11:39:34 +0000 |
commit | 8d7e32cfb6f2fbdb83a2285bd869b2cd94607ed4 (patch) | |
tree | d6a1be2d2f26e7dea9dd285317f0d2572ae778ef | |
parent | 8d5623ed1febec3e3e368e4962f75aefb44f9db9 (diff) |
From: Eric Leblond <eric@inl.fr>:
For OPRINT, changed sighup_handler_print to fallback to continue using old descriptor on new file opening failure.
Based on Marius Tomaschewski work.
-rw-r--r-- | output/ulogd_output_OPRINT.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/output/ulogd_output_OPRINT.c b/output/ulogd_output_OPRINT.c index 07364b6..563fc3b 100644 --- a/output/ulogd_output_OPRINT.c +++ b/output/ulogd_output_OPRINT.c @@ -118,15 +118,18 @@ static struct config_keyset oprint_kset = { static void sighup_handler_print(struct ulogd_pluginstance *upi, int signal) { struct oprint_priv *oi = (struct oprint_priv *) &upi->private; + FILE *old = oi->of; switch (signal) { case SIGHUP: ulogd_log(ULOGD_NOTICE, "OPRINT: reopening logfile\n"); - fclose(oi->of); oi->of = fopen(upi->config_kset->ces[0].u.string, "a"); if (!oi->of) { ulogd_log(ULOGD_ERROR, "can't open PKTLOG: %s\n", strerror(errno)); + oi->of = old; + } else { + fclose(old); } break; default: |