summaryrefslogtreecommitdiffstats
path: root/phosphor-rsyslog-config/server-conf.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'phosphor-rsyslog-config/server-conf.cpp')
-rw-r--r--phosphor-rsyslog-config/server-conf.cpp23
1 files changed, 2 insertions, 21 deletions
diff --git a/phosphor-rsyslog-config/server-conf.cpp b/phosphor-rsyslog-config/server-conf.cpp
index 16955fc..716421b 100644
--- a/phosphor-rsyslog-config/server-conf.cpp
+++ b/phosphor-rsyslog-config/server-conf.cpp
@@ -15,19 +15,6 @@
#include <string>
-#if __has_include(<filesystem>)
-#include <filesystem>
-#elif __has_include(<experimental/filesystem>)
-#include <experimental/filesystem>
-namespace std
-{
-// splice experimental::filesystem into std
-namespace filesystem = std::experimental::filesystem;
-} // namespace std
-#else
-#error filesystem not available
-#endif
-
namespace phosphor
{
namespace rsyslog_config
@@ -36,7 +23,6 @@ namespace rsyslog_config
namespace utils = phosphor::rsyslog_utils;
using namespace phosphor::logging;
using namespace sdbusplus::xyz::openbmc_project::Common::Error;
-namespace fs = std::filesystem;
std::string Server::address(std::string value)
{
@@ -108,7 +94,6 @@ uint16_t Server::port(uint16_t value)
void Server::writeConfig(const std::string& serverAddress, uint16_t serverPort,
const char* filePath)
{
- fs::create_directory(fs::path(filePath).parent_path());
std::fstream stream(filePath, std::fstream::out);
if (serverPort && !serverAddress.empty())
@@ -118,7 +103,8 @@ void Server::writeConfig(const std::string& serverAddress, uint16_t serverPort,
}
else // this is a disable request
{
- fs::remove(filePath);
+ // write '*.* ~' - this causes rsyslog to discard all messages
+ stream << "*.* ~";
}
restart();
@@ -144,11 +130,6 @@ bool Server::addressValid(const std::string& address)
void Server::restore(const char* filePath)
{
- if (!fs::exists(filePath))
- {
- return;
- }
-
std::fstream stream(filePath, std::fstream::in);
std::string line;
OpenPOWER on IntegriCloud