summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJohannes Hofmann <Johannes.Hofmann@gmx.de>2009-04-08 10:56:18 +0200
committerJohannes Hofmann <Johannes.Hofmann@gmx.de>2009-04-08 10:56:18 +0200
commit6a03f60cada3c05e65b1fb731a5ff924900baf6a (patch)
treeb38cf35dd3d9c1b12a7c6b90cfb07506f62e877a /src
parentd7c4f546ab3d9db8be1c52e8b66b024ac20361df (diff)
use O_BINARY flag when available
Diffstat (limited to 'src')
-rw-r--r--src/ImageMetaData.cxx8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/ImageMetaData.cxx b/src/ImageMetaData.cxx
index 793903a..b738b4d 100644
--- a/src/ImageMetaData.cxx
+++ b/src/ImageMetaData.cxx
@@ -23,6 +23,10 @@
#include "../config.h"
#include "ImageMetaData.H"
+#if !defined(O_BINARY)
+#define O_BINARY 0
+#endif
+
ImageMetaData::ImageMetaData() {
_manufacturer = NULL;
_model = NULL;
@@ -204,7 +208,7 @@ ImageMetaData::save_image_jpgcom(char *in_img, char *out_img) {
tmpname = tmpbuf;
#else
tmpname = tempnam(dirname(dirbuf), ".gipfel");
- tmp_fd = open(tmpname, O_WRONLY|O_TRUNC|O_CREAT, S_IRUSR|S_IWUSR);
+ tmp_fd = open(tmpname, O_WRONLY|O_TRUNC|O_CREAT|O_BINARY, S_IRUSR|S_IWUSR);
#endif
free(dirbuf);
@@ -213,7 +217,7 @@ ImageMetaData::save_image_jpgcom(char *in_img, char *out_img) {
return 1;
}
- in_fd = open(in_img, O_RDONLY);
+ in_fd = open(in_img, O_RDONLY|O_BINARY);
if (in_fd == -1) {
perror("open");
unlink(tmpname);