aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
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,
);