mirror of
https://github.com/gesellix/Bose-SoundTouch.git
synced 2026-08-19 09:06:14 +00:00
atomicWriteFile wrote a temp file and renamed it, but never fsync'd — so an unclean power-cut on a journaling NAND filesystem (UBIFS on the speaker's /mnt/nv) could leave the renamed datastore file present but 0 bytes (the rename was journalled, the data blocks were not flushed). Now fsync the temp file before the rename and the parent directory after, via os.Root.OpenFile/Open; directory fsync is best-effort (unsupported on some filesystems). Pairs with the read-side resilience fix (#459): durability prevents the 0-byte files; resilience tolerates any that already exist. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>