summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohannes Hofmann <Johannes.Hofmann@gmx.de>2009-04-07 18:51:30 +0200
committerJohannes Hofmann <Johannes.Hofmann@gmx.de>2009-04-07 18:51:30 +0200
commite9608cf2e589c019cd602cea6e9c9f201df36a71 (patch)
tree947d1648d44ab788c665c881e6b8d8fdc4343bb8
parent493e43b486a94c55e5edeaeba0d79f4ab4484694 (diff)
check for fsync() availability
-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