[netfilter-cvslog] r7322 - branches/ulog/ulogd2/output

pablo at netfilter.org pablo at netfilter.org
Sun Feb 3 12:39:34 CET 2008


Author: pablo at netfilter.org
Date: 2008-02-03 12:39:34 +0100 (Sun, 03 Feb 2008)
New Revision: 7322

Modified:
   branches/ulog/ulogd2/output/ulogd_output_OPRINT.c
Log:
From: Eric Leblond <eric at 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.


Modified: branches/ulog/ulogd2/output/ulogd_output_OPRINT.c
===================================================================
--- branches/ulog/ulogd2/output/ulogd_output_OPRINT.c	2008-02-03 11:37:50 UTC (rev 7321)
+++ branches/ulog/ulogd2/output/ulogd_output_OPRINT.c	2008-02-03 11:39:34 UTC (rev 7322)
@@ -118,15 +118,18 @@
 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:




More information about the netfilter-cvslog mailing list