]> git.hungrycats.org Git - bees/commit
hash: fix beesstats.txt write guard for inert home_fd
authorZygo Blaxell <bees@furryterror.org>
Mon, 27 Apr 2026 20:08:51 +0000 (16:08 -0400)
committerZygo Blaxell <bees@furryterror.org>
Tue, 6 Oct 2026 05:51:40 +0000 (01:51 -0400)
commit1d9c45f03bdeaa4bfcb1f249c73c25f89d831326
tree250b013c8f52251c2c994e7145b90fe4070c20d8
parent0672682aa8dd12840c1d8e024ceeb864cc97b1bd
hash: fix beesstats.txt write guard for inert home_fd

The hash-prefetch loop in BeesHashTable::prefetch_loop() guards the
on-disk stats-file write with `if (m_ctx->home_fd())`, intending to
skip the write when paths.home is unavailable (state.persistent=no
with the directory missing).  The guard never worked: crucible's Fd
exposes `operator int() const` (returns -1 when empty) and
`bool operator!() const` but no `operator bool()`, so `if (fd)` falls
through to the int conversion and `if (-1)` is unconditionally truthy.

Use `!!m_ctx->home_fd()` to force the operator! path, matching the
existing project idiom.

Assisted-by: Claude-Code:claude-opus-4-7
Signed-off-by: Zygo Blaxell <bees@furryterror.org>
src/bees-hash.cc