mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-07-28 18:23:16 +02: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:
@@ -336,7 +336,7 @@ void Session::GenerateAndSavePrivateKey(const Sock& 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,
|
||||
std::string(m_private_key.begin(), m_private_key.end()))) {
|
||||
throw std::runtime_error(
|
||||
|
@@ -816,8 +816,6 @@ bool AppInitBasicSetup(const ArgsManager& args)
|
||||
}
|
||||
|
||||
#ifndef WIN32
|
||||
umask(077);
|
||||
|
||||
// Clean shutdown on SIGTERM
|
||||
registerSignalHandler(SIGTERM, HandleSIGTERM);
|
||||
registerSignalHandler(SIGINT, HandleSIGTERM);
|
||||
|
@@ -86,7 +86,7 @@ bool GenerateAuthCookie(std::string *cookie_out)
|
||||
std::string cookie = COOKIEAUTH_USER + ":" + HexStr(rand_pwd);
|
||||
|
||||
/** 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;
|
||||
fs::path filepath_tmp = GetAuthCookieFile(true);
|
||||
|
@@ -1360,6 +1360,11 @@ void SetupEnvironment()
|
||||
SetConsoleCP(CP_UTF8);
|
||||
SetConsoleOutputCP(CP_UTF8);
|
||||
#endif
|
||||
|
||||
#ifndef WIN32
|
||||
constexpr mode_t private_umask = 0077;
|
||||
umask(private_umask);
|
||||
#endif
|
||||
}
|
||||
|
||||
bool SetupNetworking()
|
||||
|
Reference in New Issue
Block a user