From 082a0d3acabc6e5d87f7202b7fad9e9ba7d64953 Mon Sep 17 00:00:00 2001 From: David Buckle Date: Mon, 11 Sep 2017 12:44:53 +0000 Subject: [PATCH] Adds ios::[open|app] to the parallel.cc to fix write over SELinux --- src/audit_log/writer/parallel.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/audit_log/writer/parallel.cc b/src/audit_log/writer/parallel.cc index f324eedd..e58bcef4 100644 --- a/src/audit_log/writer/parallel.cc +++ b/src/audit_log/writer/parallel.cc @@ -133,7 +133,7 @@ bool Parallel::write(Transaction *transaction, int parts, std::string *error) { return false; } - fd = open(fileName.c_str(), O_CREAT | O_WRONLY, + fd = open(fileName.c_str(), O_CREAT | O_WRONLY | O_APPEND, m_audit->getFilePermission()); if (fd < 0) { error->assign("Not able to open: " + fileName + ". " \ @@ -144,7 +144,7 @@ bool Parallel::write(Transaction *transaction, int parts, std::string *error) { std::ofstream myfile; std::string a(fileName.c_str()); - myfile.open(a); + myfile.open(a, std::ofstream::out | std::ofstream::app); myfile << log; myfile.close();