"m_close_fsync && m_fd" converts the Fd to int, so an empty Fd (-1)
passes the test and bees_fsync(-1) runs on close. Use "!!m_fd".
The test came in with commit
937af86331421ac58eeef089d5ab1623edc5b1e0
("state: add persistent state config and memory-only hash table").
Assisted-by: Claude-Code:claude-opus-5-5
BEESLOGDEBUG("Waiting for hash_writeback thread");
m_writeback_thread.join();
- if (m_persistent && m_close_fsync && m_fd) {
+ if (m_persistent && m_close_fsync && !!m_fd) {
BEESNOTE("fsync hash table on close");
BEESLOGDEBUG("fsync hash table on close");
catch_all([&]() { bees_fsync(m_fd); });