mirror of https://github.com/Icinga/icinga2.git
Introduce AtomicFile::Write()
This commit is contained in:
parent
11e37a0bd1
commit
a3e205b990
|
@ -15,6 +15,13 @@
|
|||
|
||||
using namespace icinga;
|
||||
|
||||
void AtomicFile::Write(String path, int mode, const String& content)
|
||||
{
|
||||
AtomicFile af (path, mode);
|
||||
af << content;
|
||||
af.Commit();
|
||||
}
|
||||
|
||||
AtomicFile::AtomicFile(String path, int mode) : m_Path(std::move(path))
|
||||
{
|
||||
m_TempFilename = m_Path + ".tmp.XXXXXX";
|
||||
|
|
|
@ -18,6 +18,8 @@ namespace icinga
|
|||
class AtomicFile : public boost::iostreams::stream<boost::iostreams::file_descriptor>
|
||||
{
|
||||
public:
|
||||
static void Write(String path, int mode, const String& content);
|
||||
|
||||
AtomicFile(String path, int mode);
|
||||
~AtomicFile();
|
||||
|
||||
|
|
Loading…
Reference in New Issue