fix usage of realpath

This commit is contained in:
Timothee 'TTimo' Besset 2023-04-23 23:08:28 -05:00
parent 5295644ba4
commit ddbaf03d72
1 changed files with 6 additions and 2 deletions

View File

@ -54,9 +54,13 @@ bool radCopyFile( const char *lpExistingFileName, const char *lpNewFileName, boo
int l;
bool ret = false;
char realsrc[PATH_MAX], realdest[PATH_MAX];
memset( realsrc, 0, sizeof(realsrc) );
memset( realdest, 0, sizeof(realdest) );
realpath( lpExistingFileName, realsrc );
realpath( lpNewFileName, realdest );
if ( realpath( lpExistingFileName, realsrc ) == nullptr )
strncpy( realsrc, lpExistingFileName, sizeof(realsrc) - 1 );
if ( realpath( lpNewFileName, realdest ) == nullptr )
strncpy( realdest, lpNewFileName, sizeof(realdest) - 1 );
src = fopen( realsrc, "rb" );
if ( !src ) {