Port: open files in binary mode on Windows
[babeltrace.git] / include / babeltrace / compat / memstream-internal.h
index b7ae97e86cc89d3d680afe21dfa8b857be7b44b4..0b35330eb5693014a7c34da7b9d3b55d627eeadb 100644 (file)
@@ -38,6 +38,7 @@ FILE *bt_fmemopen(void *buf, size_t size, const char *mode)
 
 #else /* BABELTRACE_HAVE_FMEMOPEN */
 
+#include <unistd.h>
 #include <stdlib.h>
 #include <stdio.h>
 #include <string.h>
@@ -139,7 +140,7 @@ FILE *bt_fmemopen(void *buf, size_t size, const char *mode)
        /*
         * We need to write to the file.
         */
-       fp = fdopen(ret, "w+");
+       fp = fdopen(ret, "wb+");
        if (!fp) {
                goto error_unlink;
        }
@@ -262,7 +263,7 @@ FILE *bt_open_memstream(char **ptr, size_t *sizeloc)
                g_free(tmpname);
                return NULL;
        }
-       fp = fdopen(ret, "w+");
+       fp = fdopen(ret, "wb+");
        if (!fp) {
                goto error_unlink;
        }
This page took 0.023343 seconds and 4 git commands to generate.