aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/i2p.cpp2
-rw-r--r--src/init.cpp2
-rw-r--r--src/rpc/request.cpp2
-rw-r--r--src/util/system.cpp5
4 files changed, 7 insertions, 4 deletions
diff --git a/src/i2p.cpp b/src/i2p.cpp
index d4139bb8e5..8e98440747 100644
--- a/src/i2p.cpp
+++ b/src/i2p.cpp
@@ -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(
diff --git a/src/init.cpp b/src/init.cpp
index c4a07069e7..73ae36e4f7 100644
--- a/src/init.cpp
+++ b/src/init.cpp
@@ -816,8 +816,6 @@ bool AppInitBasicSetup(const ArgsManager& args)
}
#ifndef WIN32
- umask(077);
-
// Clean shutdown on SIGTERM
registerSignalHandler(SIGTERM, HandleSIGTERM);
registerSignalHandler(SIGINT, HandleSIGTERM);
diff --git a/src/rpc/request.cpp b/src/rpc/request.cpp
index f554ee2116..6f37fe2a99 100644
--- a/src/rpc/request.cpp
+++ b/src/rpc/request.cpp
@@ -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);
diff --git a/src/util/system.cpp b/src/util/system.cpp
index 0cea283ece..e72c970157 100644
--- a/src/util/system.cpp
+++ b/src/util/system.cpp
@@ -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()