https://gitlab.synchro.net/main/sbbs/-/commit/d91796ec3a2d991b537ff5ac
Modified Files:
src/sbbs3/mail.cpp
Log Message:
delmail: replace the mail index and status under the header lock
delmail() relied on the mail.lock file alone and never locked the mail
base header. The lock file only stops a base from being opened; a
process that already has it open (a mail server session or its send
thread) can still add or update a message while the purge reads,
compacts and rewrites the index. Such a write could be undone by the
rewrite or, for a newly added message, be truncated off the index, and
the purge wrote back the status record it read at the start, rolling
back the last message number.
The index and status are now read and rewritten under the header lock,
which every writer takes. The headers and data of the removed messages
are freed afterward, once nothing indexes them, so the lock is held
only briefly. If the allocation files can't then be opened, the
removed messages' blocks are left allocated rather than the purge
being abandoned.
Co-Authored-By: Claude Fable 5.2 <
noreply@anthropic.com>
---
þ Synchronet þ Vertrauen þ Home of Synchronet þ [vert/cvs/bbs].synchro.net