mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-03-05 14:06:27 -05:00
Apply default umask in SetupEnvironment()
This change makes all filesystem artifacts--files and directories--being created with the default umask.
This commit is contained in:
parent
8a6219e543
commit
581f16ef34
4 changed files with 7 additions and 4 deletions
|
@ -336,7 +336,7 @@ void Session::GenerateAndSavePrivateKey(const Sock& sock)
|
||||||
{
|
{
|
||||||
DestGenerate(sock);
|
DestGenerate(sock);
|
||||||
|
|
||||||
// umask is set to 077 in init.cpp, which is ok.
|
// umask is set to 0077 in util/system.cpp, which is ok.
|
||||||
if (!WriteBinaryFile(m_private_key_file,
|
if (!WriteBinaryFile(m_private_key_file,
|
||||||
std::string(m_private_key.begin(), m_private_key.end()))) {
|
std::string(m_private_key.begin(), m_private_key.end()))) {
|
||||||
throw std::runtime_error(
|
throw std::runtime_error(
|
||||||
|
|
|
@ -816,8 +816,6 @@ bool AppInitBasicSetup(const ArgsManager& args)
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef WIN32
|
#ifndef WIN32
|
||||||
umask(077);
|
|
||||||
|
|
||||||
// Clean shutdown on SIGTERM
|
// Clean shutdown on SIGTERM
|
||||||
registerSignalHandler(SIGTERM, HandleSIGTERM);
|
registerSignalHandler(SIGTERM, HandleSIGTERM);
|
||||||
registerSignalHandler(SIGINT, HandleSIGTERM);
|
registerSignalHandler(SIGINT, HandleSIGTERM);
|
||||||
|
|
|
@ -86,7 +86,7 @@ bool GenerateAuthCookie(std::string *cookie_out)
|
||||||
std::string cookie = COOKIEAUTH_USER + ":" + HexStr(rand_pwd);
|
std::string cookie = COOKIEAUTH_USER + ":" + HexStr(rand_pwd);
|
||||||
|
|
||||||
/** the umask determines what permissions are used to create this file -
|
/** the umask determines what permissions are used to create this file -
|
||||||
* these are set to 077 in init.cpp.
|
* these are set to 0077 in util/system.cpp.
|
||||||
*/
|
*/
|
||||||
std::ofstream file;
|
std::ofstream file;
|
||||||
fs::path filepath_tmp = GetAuthCookieFile(true);
|
fs::path filepath_tmp = GetAuthCookieFile(true);
|
||||||
|
|
|
@ -1360,6 +1360,11 @@ void SetupEnvironment()
|
||||||
SetConsoleCP(CP_UTF8);
|
SetConsoleCP(CP_UTF8);
|
||||||
SetConsoleOutputCP(CP_UTF8);
|
SetConsoleOutputCP(CP_UTF8);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef WIN32
|
||||||
|
constexpr mode_t private_umask = 0077;
|
||||||
|
umask(private_umask);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SetupNetworking()
|
bool SetupNetworking()
|
||||||
|
|
Loading…
Add table
Reference in a new issue