If *record* is set, avoid writing dead content twice..
If a message cannot be sent it is written to *DEAD*. However,
if *record* is also set it is written to *DEAD* twice.
It happens to be fixable on Mac OS X Snow Leopard, NetBSD 6,
OpenBSD 5.1 if a lseek(2) call in sendout.c:savemail() is removed.
This lseek(2) call bypasses the Std I/O mechanism. Well, a very
fflush(3)/fseek(3) combination is defined for POSIX-conforming
systems, and as an extension of the C standard (this is from IEEE
Std 1003.1, 1996 Edition):
8.2.3.7 fseek(), rewind()
[.]
If the most recent operation, other than ftell(), on a given
stream is fflush(), the file offset in the underlying open
file description shall be adjusted to reflect the location
specified by the fseek().
Even then it is questionable wether an application should assume
internals about stdio and, even more, kernel states. On the
other hand it is completely mysterious to me why the mentioned
stdio libs do not catch that, and on the other hand. But
i don't know enough of how nail(1) functions and so maybe it's
my fault.
The Heirloom repo doesn't offer any annotate info on these
lines, they are present from the beginning.
This is not politics but a bug.