OpenDiskFile was always opening files in "rb+" mode (read-write binary), and if that failed and fReadOnly was false, trying to truncate the file. Truncate would always fail (AFAIK) unless a race condition set the file read-write between the two attempts.
This changes it to actually honour fReadOnly. The truncate race ''is not'' fixed, and cannot easily be fixed (fopen lacks a "open read-write, random access, but don't truncate" mode). If we want to actually try truncating in !fReadOnly mode, I'm pretty sure we need to unlink first.
This bug was introduced as part of ultraprune, so does not affect any released versions.