1
0
Fork 0
mirror of https://github.com/sockspls/badfish synced 2025-06-28 00:19:50 +00:00

Only close file if already open

Ensures that the tablebase file is only closed if already open.

Fixes #4268
Closes https://github.com/official-stockfish/Stockfish/pull/4321

No functional change
This commit is contained in:
Jake Senne 2023-01-03 15:16:45 -06:00 committed by Joost VandeVondele
parent 4101893a28
commit fcee83810a
2 changed files with 4 additions and 6 deletions

View file

@ -92,6 +92,7 @@ Ivan Ivec (IIvec)
Jacques B. (Timshel) Jacques B. (Timshel)
Jan Ondruš (hxim) Jan Ondruš (hxim)
Jared Kish (Kurtbusch, kurt22i) Jared Kish (Kurtbusch, kurt22i)
Jake Senne (w1wwwwww)
Jarrod Torriero (DU-jdto) Jarrod Torriero (DU-jdto)
Jean Gauthier (OuaisBla) Jean Gauthier (OuaisBla)
Jean-Francois Romang (jromang) Jean-Francois Romang (jromang)

View file

@ -199,12 +199,9 @@ public:
} }
} }
// Memory map the file and check it. File should be already open and will be // Memory map the file and check it.
// closed after mapping.
uint8_t* map(void** baseAddress, uint64_t* mapping, TBType type) { uint8_t* map(void** baseAddress, uint64_t* mapping, TBType type) {
if (is_open())
assert(is_open());
close(); // Need to re-open to get native file descriptor close(); // Need to re-open to get native file descriptor
#ifndef _WIN32 #ifndef _WIN32