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)
This commit is contained in:
Riccardo Spagni 2016-04-14 16:21:29 +09:00
commit a299e5269b
No known key found for this signature in database
GPG Key ID: 55432DF31CCD4FCD
3 changed files with 12 additions and 0 deletions

View File

@ -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
}
}

View File

@ -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);
}

View File

@ -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]);