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

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