[PATCH 07/34] 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]

 



This patch is a backport of Marius Tomaschewski <mt@xxxxxxx> work on ulogd.

Signed-off-by: Eric leblond <eric@xxxxxx>
---
:100644 100644 c18aad7... b8d3903... M	output/ulogd_output_LOGEMU.c
 output/ulogd_output_LOGEMU.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/output/ulogd_output_LOGEMU.c b/output/ulogd_output_LOGEMU.c
index c18aad7..b8d3903 100644
--- a/output/ulogd_output_LOGEMU.c
+++ b/output/ulogd_output_LOGEMU.c
@@ -114,15 +114,18 @@ static int _output_logemu(struct ulogd_pluginstance *upi)
 static void signal_handler_logemu(struct ulogd_pluginstance *pi, int signal)
 {
 	struct logemu_instance *li = (struct logemu_instance *) &pi->private;
+	FILE *old = li->of;
 
 	switch (signal) {
 	case SIGHUP:
 		ulogd_log(ULOGD_NOTICE, "syslogemu: reopening logfile\n");
-		fclose(li->of);
 		li->of = fopen(pi->config_kset->ces[0].u.string, "a");
 		if (!li->of) {
 			ulogd_log(ULOGD_ERROR, "can't reopen syslogemu: %s\n",
 				  strerror(errno));
+			li->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