]> xenbits.xensource.com Git - libvirt.git/commit
Introduce virFileRewrite for safe file rewrite
authorJiri Denemark <jdenemar@redhat.com>
Thu, 13 Oct 2011 10:17:12 +0000 (12:17 +0200)
committerJiri Denemark <jdenemar@redhat.com>
Thu, 27 Oct 2011 18:11:24 +0000 (20:11 +0200)
commit559644ddd2fd7065220331d11197bf54f6484231
treef31046c5c2d8a0f752404fc0996adf4d12952b94
parent9b76b08ae41e725d916dccbb6f300d014ff421f2
Introduce virFileRewrite for safe file rewrite

When saving config files we just overwrite old content of the file. In
case something fails during that process (e.g. disk gets full) we lose
both old and new content. This patch makes the process more robust by
writing the new content into a separate file and only if that succeeds
the original file is atomically replaced with the new one.
src/libvirt_private.syms
src/util/virfile.c
src/util/virfile.h