diff options
author | Mounir IDRASSI <mounir.idrassi@idrix.fr> | 2020-03-09 11:34:21 +0100 |
---|---|---|
committer | Mounir IDRASSI <mounir.idrassi@idrix.fr> | 2020-03-10 10:33:01 +0100 |
commit | da370af54b419132d5f1e990f79b06ad8ebe66c0 (patch) | |
tree | 29749bc61bb0f74eb9601c98bb2431dd26c233a7 /src/Common/libzip/zip_source_win32a.c | |
parent | 7d110798d2ec1dae02310939c1bd6b036b90f6bf (diff) | |
download | VeraCrypt-da370af54b419132d5f1e990f79b06ad8ebe66c0.tar.gz VeraCrypt-da370af54b419132d5f1e990f79b06ad8ebe66c0.zip |
Windows: Update libzip to 1.6.1
Diffstat (limited to 'src/Common/libzip/zip_source_win32a.c')
-rw-r--r-- | src/Common/libzip/zip_source_win32a.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/Common/libzip/zip_source_win32a.c b/src/Common/libzip/zip_source_win32a.c index b4b060a8..257fc6aa 100644 --- a/src/Common/libzip/zip_source_win32a.c +++ b/src/Common/libzip/zip_source_win32a.c @@ -1,6 +1,6 @@ /* zip_source_win32a.c -- create data source from Windows file (ANSI) - Copyright (C) 1999-2018 Dieter Baron and Thomas Klausner + Copyright (C) 1999-2019 Dieter Baron and Thomas Klausner This file is part of libzip, a library to manipulate ZIP archives. The authors can be contacted at <libzip@nih.at> @@ -112,8 +112,18 @@ _win32_create_temp_a(_zip_source_win32_read_file_t *ctx, void **temp, zip_uint32 static int _win32_rename_temp_a(_zip_source_win32_read_file_t *ctx) { + DWORD attributes = GetFileAttributesA(ctx->tmpname); + if (INVALID_FILE_ATTRIBUTES == attributes) + return -1; + + if (FILE_ATTRIBUTE_TEMPORARY & attributes) { + if (!SetFileAttributesA(ctx->tmpname, attributes & ~FILE_ATTRIBUTE_TEMPORARY)) + return -1; + } + if (!MoveFileExA(ctx->tmpname, ctx->fname, MOVEFILE_REPLACE_EXISTING)) return -1; + return 0; } |