<<< Date Index >>>     <<< Thread Index >>>

mutt_unlink overwrites file to be unlinked



Hi,

while looking into http://dev.mutt.org/trac/ticket/3261, I discovered
that mutt_unlink in lib.c does not only performs some checks and
unlinks a file, it also overwrites every bit in the file with zeros.
The relevant code has been in the repository since revision 0, and
there are no comments to explain what's going on.

As a consequence of this, the unlink code fails if it called on a
read-only file, as happened with a first fix for the above bug. The
ugly fix for that now is to change file permission before calling
mutt_unlink.

Presumably there are some security considerations, but I honestly
don't see why it would make sense to go as far put all zeros in the
file. This doesn't necessarily do anything (think of copy-on-write
filesystems), and also comes with a performance penalty on large
files. Am I missing something here?

I'd like to change mutt_unlink so that it simply doesn't write all the
zeros.

Philipp