mirror of
https://github.com/AGWA/git-crypt.git
synced 2025-12-22 23:26:11 -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
@@ -325,3 +325,16 @@ static void init_std_streams_platform ()
|
||||
_setmode(_fileno(stdin), _O_BINARY);
|
||||
_setmode(_fileno(stdout), _O_BINARY);
|
||||
}
|
||||
|
||||
mode_t util_umask (mode_t mode)
|
||||
{
|
||||
// Not available in Windows and function not always defined in Win32 environments
|
||||
return 0;
|
||||
}
|
||||
|
||||
int util_rename (const char* from, const char* to)
|
||||
{
|
||||
// On Windows OS, it is necessary to ensure target file doesn't exist
|
||||
unlink(to);
|
||||
return rename(from, to);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user