Blame SOURCES/rsyslog-8.2102.0-rhbz1960536-fdleak-on-fsync.patch

f4f2f7
diff -up rsyslog-8.2102.0/plugins/imjournal/imjournal.c.orig rsyslog-8.2102.0/plugins/imjournal/imjournal.c
f4f2f7
--- rsyslog-8.2102.0/plugins/imjournal/imjournal.c.orig	2021-06-15 12:30:35.238832058 +0200
f4f2f7
+++ rsyslog-8.2102.0/plugins/imjournal/imjournal.c	2021-06-15 12:32:04.699721356 +0200
f4f2f7
@@ -565,6 +565,8 @@ persistJournalState(void)
f4f2f7
 		ABORT_FINALIZE(RS_RET_IO_ERROR);
f4f2f7
 	}
f4f2f7
 
f4f2f7
+	fflush(sf);
f4f2f7
+
f4f2f7
 	/* change the name of the file to the configured one */
f4f2f7
 	if (rename(tmp_sf, cs.stateFile) < 0) {
f4f2f7
 		LogError(errno, iRet, "imjournal: rename() failed for new path: '%s'", cs.stateFile);
f4f2f7
@@ -586,6 +588,7 @@ persistJournalState(void)
f4f2f7
 			LogError(errno, RS_RET_IO_ERROR, "imjournal: fsync on '%s' failed", glbl.GetWorkDir());
f4f2f7
 			ABORT_FINALIZE(RS_RET_IO_ERROR);
f4f2f7
 		}
f4f2f7
+		closedir(wd);
f4f2f7
 	}
f4f2f7
 
f4f2f7
 	DBGPRINTF("Persisted journal to '%s'\n", cs.stateFile);