Skip to content

Commit 86095bc

Browse files
committed
Document rename_replace_existing macro
1 parent fdda7de commit 86095bc

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

library/psa_its_file.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,12 @@
6262
#define PSA_ITS_MAGIC_STRING "PSA\0ITS\0"
6363
#define PSA_ITS_MAGIC_LENGTH 8
6464

65+
/* As rename fails on Windows if the new filepath already exists,
66+
* use MoveFileExA with the MOVEFILE_REPLACE_EXISTING flag instead.
67+
* Returns 0 on success, nonzero on failure. */
6568
#if defined(_WIN32)
6669
#define rename_replace_existing( oldpath, newpath ) \
67-
(!MoveFileExA( oldpath, newpath, MOVEFILE_REPLACE_EXISTING ))
70+
( ! MoveFileExA( oldpath, newpath, MOVEFILE_REPLACE_EXISTING ) )
6871
#else
6972
#define rename_replace_existing( oldpath, newpath ) rename( oldpath, newpath )
7073
#endif

0 commit comments

Comments
 (0)