summaryrefslogtreecommitdiffstats
path: root/ulogd/extensions/ulogd_OPRINT.c
diff options
context:
space:
mode:
authorlaforge <laforge>2001-06-14 19:25:25 +0000
committerlaforge <laforge>2001-06-14 19:25:25 +0000
commit71fd5ce504ee00c96ba8033b1c54fa04614a98a6 (patch)
treecd76be0ad990eb3010583991e3da2657488b5ce2 /ulogd/extensions/ulogd_OPRINT.c
parent5a94632e3102bdb60db0ce863e0e01a08d02e109 (diff)
Support for logfile cycling (SIGHUP handler)
Diffstat (limited to 'ulogd/extensions/ulogd_OPRINT.c')
-rw-r--r--ulogd/extensions/ulogd_OPRINT.c34
1 files changed, 27 insertions, 7 deletions
diff --git a/ulogd/extensions/ulogd_OPRINT.c b/ulogd/extensions/ulogd_OPRINT.c
index fc00b46..979548d 100644
--- a/ulogd/extensions/ulogd_OPRINT.c
+++ b/ulogd/extensions/ulogd_OPRINT.c
@@ -1,11 +1,11 @@
-/* ulogd_MAC.c, Version $Revision: 1.5 $
+/* ulogd_MAC.c, Version $Revision: 1.6 $
*
* ulogd output target for logging to a file
*
* (C) 2000 by Harald Welte <laforge@gnumonks.org>
* This software is released under the terms of GNU GPL
*
- * $Id: ulogd_OPRINT.c,v 1.5 2000/11/16 17:20:52 laforge Exp $
+ * $Id: ulogd_OPRINT.c,v 1.6 2000/11/20 11:43:22 laforge Exp $
*
*/
@@ -67,9 +67,32 @@ int _output_print(ulog_iret_t *res)
return 0;
}
+static config_entry_t outf_ce = { NULL, "dumpfile", CONFIG_TYPE_STRING,
+ CONFIG_OPT_NONE, 0,
+ { string: ULOGD_OPRINT_DEFAULT } };
+
+void sighup_handler_print(int signal)
+{
+
+ switch (signal) {
+ case SIGHUP:
+ ulogd_log(ULOGD_NOTICE, "PKTLOG: reopening logfile\n");
+ fclose(of);
+ of = fopen(outf_ce.u.string, "a");
+ if (!of) {
+ ulogd_log(ULOGD_FATAL, "can't open PKTLOG: %s\n",
+ strerror(errno));
+ exit(2);
+ }
+ break;
+ default:
+ break;
+ }
+}
+
static ulog_output_t base_op[] = {
- { NULL, "oprint", &_output_print },
- { NULL, "", NULL },
+ { NULL, "oprint", &_output_print, &sighup_handler_print },
+ { NULL, "", NULL, NULL },
};
@@ -82,9 +105,6 @@ static void _base_reg_op(void)
register_output(p);
}
-static config_entry_t outf_ce = { NULL, "dumpfile", CONFIG_TYPE_STRING,
- CONFIG_OPT_NONE, 0,
- { string: ULOGD_OPRINT_DEFAULT } };
void _init(void)
{
#ifdef DEBUG