https://bugs.openldap.org/show_bug.cgi?id=9397
--- Comment #1 from Howard Chu hyc@openldap.org --- (In reply to github@nicwatson.org from comment #0)
The most straightforward solution is to allow ftruncate to *reduce* the file size if it is the only reader.
Yes. Patch welcome.
Another possibility is check the file size and ftruncate if necessary every time a write transaction is opened.
No, too slow, and wouldn't catch the problem every time. You would need to check on every actual write operation all the way up to the final commit.
A third possibility is to catch the SIGBUS signal.
No, libraries should never muck with signal handlers. Particularly in a multithreaded app where the signal may have occurred due to some other thread completely unrelated to this library. Only the main app should ever touch signal controls.