[PATCH 09/34] For OPRINT, changed sighup_handler_print to fallback to continue using old descriptor on new file opening failure.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Based on Marius Tomaschewski work.

Signed-off-by: Eric leblond <eric@xxxxxx>
---
:100644 100644 07364b6... 563fc3b... M	output/ulogd_output_OPRINT.c
 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:
-- 
1.5.2.5

-
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Netfitler Users]     [Berkeley Packet Filter]     [LARTC]     [Bugtraq]     [Yosemite Forum]

  Powered by Linux