On Mon, 17 Mar 2008, Morten Welinder wrote:
quoted
unlink(path);
And checking the result from unlink might not hurt either.
Well, that part is actually intentional. We simply don't care. If the
unlink succeeds, we're happy, if it fails, we're happy. No reason to test,
really.
(Well, it's not that we're "happy" if the unlink fails, but we actually
_expect_ it to fail for directories, and regardless of that we're really
doing the _real_ error handling later when we actually create the new
entry that will replace the old one, so we don't much care at unlink
time).
IOW, the real "checking" is taking place in "create_file()", so if the
unlinking failed (due to a read-only directory or something), that's where
we'll do the proper error reporting.
Linus