Add missing "O_TRUNC" for writing files.

Actually, it is possible to go one step further and unlink the file
if it exists.  That way, if anyone has hard links to the file, their
"copy" will not be overwritten.  Not sure if it's up to the library
to make that decision, though.