aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRiccardo Spagni <ric@spagni.net>2016-04-14 16:21:29 +0900
committerRiccardo Spagni <ric@spagni.net>2016-04-14 16:21:29 +0900
commita299e5269b4a46f80a340940ec21f707e8dc8c7c (patch)
tree40e88484567b12235b1632faf759fc8788f07355 /src
parentMerge pull request #800 (diff)
parentsimplewallet: set strict umask at start (diff)
downloadmonero-a299e5269b4a46f80a340940ec21f707e8dc8c7c.tar.xz
Merge pull request #801
ed61a2c simplewallet: set strict umask at start (moneromooo-monero) 7385c03 util: add a function to set umask to 077 (moneromooo-monero)
Diffstat (limited to 'src')
-rw-r--r--src/common/util.cpp9
-rw-r--r--src/common/util.h2
-rw-r--r--src/simplewallet/simplewallet.cpp1
3 files changed, 12 insertions, 0 deletions
diff --git a/src/common/util.cpp b/src/common/util.cpp
index 6f75e5bad..2337f5766 100644
--- a/src/common/util.cpp
+++ b/src/common/util.cpp
@@ -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
+ }
}
diff --git a/src/common/util.h b/src/common/util.h
index 7554b1df7..ed1c16cb0 100644
--- a/src/common/util.h
+++ b/src/common/util.h
@@ -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);
}
diff --git a/src/simplewallet/simplewallet.cpp b/src/simplewallet/simplewallet.cpp
index 30c958381..c053f462b 100644
--- a/src/simplewallet/simplewallet.cpp
+++ b/src/simplewallet/simplewallet.cpp
@@ -2812,6 +2812,7 @@ int main(int argc, char* argv[])
std::string lang = i18n_get_language();
tools::sanitize_locale();
+ tools::set_strict_default_file_permissions(true);
string_tools::set_module_name_and_folder(argv[0]);