7
mirror of https://gitlab.com/kicad/code/kicad.git synced 2025-04-20 12:01:41 +00:00

Add error handling to posix function call

This commit is contained in:
Ian McInerney 2024-12-30 18:57:49 +00:00
parent 2aa079d58c
commit 2ddcc7a7ad

View File

@ -32,7 +32,13 @@ FILE* KIPLATFORM::IO::SeqFOpen( const wxString& aPath, const wxString& aMode )
FILE* fp = wxFopen( aPath, aMode );
if( fp )
posix_fadvise( fileno( fp ), 0, 0, POSIX_FADV_SEQUENTIAL );
{
if( posix_fadvise( fileno( fp ), 0, 0, POSIX_FADV_SEQUENTIAL ) != 0 )
{
fclose( fp );
fp = nullptr;
}
}
return fp;
}