aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMartin Willi <martin@revosec.ch>2014-01-13 16:20:19 +0100
committerMartin Willi <martin@revosec.ch>2014-06-04 15:53:08 +0200
commitc5447bc2f5eb2d98cd8ed8acca7a1e0bb4176620 (patch)
tree3cd24448d27b860c28bbc23e118ea5c7e6525b32 /src
parent2877355408d539af08b85586e1f30bceaa2933e1 (diff)
downloadstrongswan-c5447bc2f5eb2d98cd8ed8acca7a1e0bb4176620.tar.bz2
strongswan-c5447bc2f5eb2d98cd8ed8acca7a1e0bb4176620.tar.xz
chunk: On Windows, chunk_map() opens files in binary mode
Diffstat (limited to 'src')
-rw-r--r--src/libstrongswan/utils/chunk.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/libstrongswan/utils/chunk.c b/src/libstrongswan/utils/chunk.c
index 7958931d0..de8996c82 100644
--- a/src/libstrongswan/utils/chunk.c
+++ b/src/libstrongswan/utils/chunk.c
@@ -333,10 +333,15 @@ chunk_t *chunk_map(char *path, bool wr)
{
mmaped_chunk_t *chunk;
struct stat sb;
- int tmp;
+ int tmp, flags;
+
+ flags = wr ? O_RDWR : O_RDONLY;
+#ifdef WIN32
+ flags |= O_BINARY;
+#endif
INIT(chunk,
- .fd = open(path, wr ? O_RDWR : O_RDONLY),
+ .fd = open(path, flags),
.wr = wr,
);