mirror of
https://github.com/AGWA/git-crypt.git
synced 2025-12-26 20:53:08 -08:00
Add umask and rename compatibility wrappers for Windows
umask() doesn't exist on Windows and is thus a no-op. rename() only works if the destination doesn't already exist, so we must unlink before renaming.
This commit is contained in:
committed by
Andrew Ayer
parent
dcea03f0d7
commit
df2b472cd9
4
key.cpp
4
key.cpp
@@ -134,9 +134,9 @@ bool Key_file::load_from_file (const char* key_file_name)
|
||||
|
||||
bool Key_file::store_to_file (const char* key_file_name) const
|
||||
{
|
||||
mode_t old_umask = umask(0077); // make sure key file is protected (TODO: Windows compat)
|
||||
mode_t old_umask = util_umask(0077); // make sure key file is protected
|
||||
std::ofstream key_file_out(key_file_name, std::fstream::binary);
|
||||
umask(old_umask);
|
||||
util_umask(old_umask);
|
||||
if (!key_file_out) {
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user