Introduce an io function that implements a flushed file write to a temporary
file, an optional permission copy and then a rename to a final name in one
step.

The problem with the old implementation as two separate functions was that the
flush was required for the atomic rename (as fsfs commit), but the
implementation was part of the write file function that also had other users.

Try to delete the temporary file in most error cases.

* subversion/include/svn_io.h
  (svn_io_write_atomic): New function.

* subversion/libsvn_fs_fs/fs_fs.c
  (write_format,
   get_and_increment_txn_key_body,
   svn_fs_fs__change_txn_props,
   write_current,
   svn_fs_fs__set_uuid): Replace code with call to svn_io_write_atomic.

* subversion/libsvn_subr/io.c
  (svn_io_write_atomic): New function.

* subversion/libsvn_wc/workqueue.c
  (run_postupgrade): Use svn_io_write_atomic.

* subversion/mod_dav_svn/activity.c
  (dav_svn__store_activity): Use svn_io_write_atomic.

* subversion/tests/libsvn_fs_fs/fs-pack-test.c
  (write_format): Use svn_io_write_atomic.


git-svn-id: https://svn.apache.org/repos/asf/subversion/trunk@1484092 13f79535-47bb-0310-9956-ffa450edef68