]> git.ipfire.org Git - thirdparty/strongswan.git/commitdiff
chunk: On Windows, use binary mode in chunk_write()
authorMartin Willi <martin@revosec.ch>
Sat, 8 Mar 2014 13:37:28 +0000 (14:37 +0100)
committerMartin Willi <martin@revosec.ch>
Wed, 4 Jun 2014 13:53:10 +0000 (15:53 +0200)
src/libstrongswan/utils/chunk.c

index de8996c82217de0500f5300a8d4d5703dd968e20..ef79a74531c3f264480b8fea6d2b1f1f71d24cab 100644 (file)
@@ -221,7 +221,14 @@ bool chunk_write(chunk_t chunk, char *path, mode_t mask, bool force)
                return FALSE;
        }
        oldmask = umask(mask);
-       fd = fopen(path, "w");
+       fd = fopen(path,
+#ifdef WIN32
+                               "wb"
+#else
+                               "w"
+#endif
+       );
+
        if (fd)
        {
                if (fwrite(chunk.ptr, sizeof(u_char), chunk.len, fd) == chunk.len)