File tree Expand file tree Collapse file tree 1 file changed +8
-6
lines changed Expand file tree Collapse file tree 1 file changed +8
-6
lines changed Original file line number Diff line number Diff line change 62
62
#define PSA_ITS_MAGIC_STRING "PSA\0ITS\0"
63
63
#define PSA_ITS_MAGIC_LENGTH 8
64
64
65
+ #if defined(_WIN32 )
66
+ #define rename_replace_existing ( oldpath , newpath ) \
67
+ (!MoveFileExA( oldpath, newpath, MOVEFILE_REPLACE_EXISTING ))
68
+ #else
69
+ #define rename_replace_existing ( oldpath , newpath ) rename( oldpath, newpath )
70
+ #endif
71
+
65
72
typedef struct
66
73
{
67
74
uint8_t magic [PSA_ITS_MAGIC_LENGTH ];
@@ -213,12 +220,7 @@ psa_status_t psa_its_set( psa_storage_uid_t uid,
213
220
}
214
221
if ( status == PSA_SUCCESS )
215
222
{
216
- #if defined(_WIN32 )
217
- if ( MoveFileExA ( PSA_ITS_STORAGE_TEMP , filename ,
218
- MOVEFILE_REPLACE_EXISTING ) == 0 )
219
- #else
220
- if ( rename ( PSA_ITS_STORAGE_TEMP , filename ) != 0 )
221
- #endif
223
+ if ( rename_replace_existing ( PSA_ITS_STORAGE_TEMP , filename ) != 0 )
222
224
status = PSA_ERROR_STORAGE_FAILURE ;
223
225
}
224
226
remove ( PSA_ITS_STORAGE_TEMP );
You can’t perform that action at this time.
0 commit comments