From e9608cf2e589c019cd602cea6e9c9f201df36a71 Mon Sep 17 00:00:00 2001 From: Johannes Hofmann Date: Tue, 7 Apr 2009 18:51:30 +0200 Subject: check for fsync() availability --- configure.ac | 2 +- src/ImageMetaData.cxx | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index f15cf0a..28acc01 100644 --- a/configure.ac +++ b/configure.ac @@ -34,7 +34,7 @@ AC_FUNC_FORK AC_FUNC_MALLOC AC_FUNC_REALLOC AC_TYPE_SIGNAL -AC_CHECK_FUNCS([strchr strdup strrchr strstr mkstemp]) +AC_CHECK_FUNCS([strchr strdup strrchr strstr mkstemp fsync]) # Check for fltk AC_PATH_PROG(FLTKCONFIG,fltk-config) diff --git a/src/ImageMetaData.cxx b/src/ImageMetaData.cxx index a4e7174..7cedcf2 100644 --- a/src/ImageMetaData.cxx +++ b/src/ImageMetaData.cxx @@ -258,7 +258,10 @@ ImageMetaData::save_image_jpgcom(char *in_img, char *out_img) { err++; } +#ifdef HAVE_FSYNC fsync(tmp_fd); // make sure data is on disk before replacing orig file +#endif + close(tmp_fd); if (err == 0) { // only overwrite existing image if everything was ok -- cgit v1.2.3