util: add a function to set umask to 077
Useful to ensure files are written without group/other read rights.
This commit is contained in:
parent
e7c8a32a28
commit
7385c036bd
2 changed files with 11 additions and 0 deletions
|
@ -413,4 +413,13 @@ std::string get_nix_version_display_string()
|
|||
}
|
||||
return false;
|
||||
}
|
||||
void set_strict_default_file_permissions(bool strict)
|
||||
{
|
||||
#if defined(__MINGW32__) || defined(__MINGW__)
|
||||
// no clue about the odd one out
|
||||
#else
|
||||
mode_t mode = strict ? 077 : 0;
|
||||
umask(mode);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
|
|
@ -158,4 +158,6 @@ namespace tools
|
|||
/*! \brief where the installed handler is stored */
|
||||
static std::function<void(int)> m_handler;
|
||||
};
|
||||
|
||||
void set_strict_default_file_permissions(bool strict);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue