fix usage of realpath

This commit is contained in:
Timothee 'TTimo' Besset 2023-04-23 23:08:28 -05:00
parent 5295644ba4
commit ddbaf03d72

View file

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