From: Martin Willi Date: Mon, 13 Jan 2014 15:20:19 +0000 (+0100) Subject: chunk: On Windows, chunk_map() opens files in binary mode X-Git-Tag: 5.2.0dr6~24^2~45 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c5447bc2f5eb2d98cd8ed8acca7a1e0bb4176620;p=thirdparty%2Fstrongswan.git chunk: On Windows, chunk_map() opens files in binary mode --- diff --git a/src/libstrongswan/utils/chunk.c b/src/libstrongswan/utils/chunk.c index 7958931d06..de8996c822 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, );