mirror of https://github.com/Icinga/icinga2.git
parent
289ca2ec24
commit
1d4065ba94
|
@ -591,7 +591,7 @@ bool NodeUtility::CheckAgainstBlackAndWhiteList(const String& type, const String
|
||||||
/*
|
/*
|
||||||
* We generally don't overwrite files without backup before
|
* We generally don't overwrite files without backup before
|
||||||
*/
|
*/
|
||||||
bool NodeUtility::CreateBackupFile(const String& target)
|
bool NodeUtility::CreateBackupFile(const String& target, mode_t mode)
|
||||||
{
|
{
|
||||||
if (!Utility::PathExists(target))
|
if (!Utility::PathExists(target))
|
||||||
return false;
|
return false;
|
||||||
|
@ -606,6 +606,10 @@ bool NodeUtility::CreateBackupFile(const String& target)
|
||||||
|
|
||||||
Utility::CopyFile(target, backup);
|
Utility::CopyFile(target, backup);
|
||||||
|
|
||||||
|
#ifndef _WIN32
|
||||||
|
chmod(backup.CStr(), mode);
|
||||||
|
#endif /* _WIN32 */
|
||||||
|
|
||||||
Log(LogInformation, "cli")
|
Log(LogInformation, "cli")
|
||||||
<< "Created backup file '" << backup << "'.";
|
<< "Created backup file '" << backup << "'.";
|
||||||
|
|
||||||
|
|
|
@ -51,7 +51,7 @@ public:
|
||||||
|
|
||||||
static std::vector<Dictionary::Ptr> GetNodes(void);
|
static std::vector<Dictionary::Ptr> GetNodes(void);
|
||||||
|
|
||||||
static bool CreateBackupFile(const String& target);
|
static bool CreateBackupFile(const String& target, mode_t mode = 0640);
|
||||||
|
|
||||||
static bool WriteNodeConfigObjects(const String& filename, const Array::Ptr& objects);
|
static bool WriteNodeConfigObjects(const String& filename, const Array::Ptr& objects);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue