diff options
author | moneromooo-monero <moneromooo-monero@users.noreply.github.com> | 2016-04-06 19:59:34 +0100 |
---|---|---|
committer | moneromooo-monero <moneromooo-monero@users.noreply.github.com> | 2016-04-06 19:59:34 +0100 |
commit | 7385c036bdd2e9254be99024ddcec639b668f68a (patch) | |
tree | 1db1cef3e903ce8f872f979f2d48536b8b65e421 /src/common/util.cpp | |
parent | Merge pull request #780 (diff) | |
download | monero-7385c036bdd2e9254be99024ddcec639b668f68a.tar.xz |
util: add a function to set umask to 077
Useful to ensure files are written without group/other read rights.
Diffstat (limited to '')
-rw-r--r-- | src/common/util.cpp | 9 |
1 files changed, 9 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 + } } |