fix double-processing of DT_RELR relocations in ldso relocating itself
[musl] / src / stdio / open_memstream.c
index ee83423..600d277 100644 (file)
@@ -2,6 +2,8 @@
 #include <errno.h>
 #include <limits.h>
 #include <string.h>
+#include <stdlib.h>
+#include "libc.h"
 
 struct cookie {
        char **bufp;
@@ -89,6 +91,7 @@ FILE *open_memstream(char **bufp, size_t *sizep)
        f->f.write = ms_write;
        f->f.seek = ms_seek;
        f->f.close = ms_close;
+       f->f.mode = -1;
 
        if (!libc.threaded) f->f.lock = -1;