summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJohannes Hofmann <Johannes.Hofmann@gmx.de>2009-03-17 08:41:43 +0100
committerJohannes Hofmann <Johannes.Hofmann@gmx.de>2009-03-17 08:41:43 +0100
commitfa266635c6e6ad4ee9e82951c24e57c02a213e0b (patch)
treec298678a2b328d45a732507c29e9e3bad8b3bbcd /src
parenta3efd61d8737f7d7efade3d7cbb823e764763bf4 (diff)
fsync() temp file before rename()
Diffstat (limited to 'src')
-rw-r--r--src/ImageMetaData.cxx3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/ImageMetaData.cxx b/src/ImageMetaData.cxx
index cfa699e..f22a641 100644
--- a/src/ImageMetaData.cxx
+++ b/src/ImageMetaData.cxx
@@ -266,7 +266,8 @@ ImageMetaData::save_image_jpgcom(char *in_img, char *out_img) {
err++;
}
- close(tmp_fd);
+ fsync(tmp_fd); /* make sure data is on disk before replacing orig file */
+ close(tmp_fd);
if (!err) {
if (rename(tmpname, out_img) != 0) {