summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--configure.ac2
-rw-r--r--src/ImageMetaData.cxx3
2 files changed, 4 insertions, 1 deletions
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