X-Git-Url: http://nsz.repo.hu/git/?p=musl;a=blobdiff_plain;f=src%2Fstdio%2Ffmemopen.c;h=d78496091d255a9d54d57ca0f075ce1c84e8487f;hp=770fd9953a63274cea74a24a4b1a7dd391c33824;hb=41d7c77d6a2e74294807d35062e4cd1d48ab72d3;hpb=400c5e5c8307a2ebe44ef1f203f5a15669f20347 diff --git a/src/stdio/fmemopen.c b/src/stdio/fmemopen.c index 770fd995..d7849609 100644 --- a/src/stdio/fmemopen.c +++ b/src/stdio/fmemopen.c @@ -1,4 +1,7 @@ #include "stdio_impl.h" +#include +#include +#include struct cookie { size_t pos, len, size; @@ -105,12 +108,13 @@ FILE *fmemopen(void *restrict buf, size_t size, const char *restrict mode) f->seek = mseek; f->close = mclose; - if (!libc.threaded) { - f->lock = -1; - f->next = libc.ofl_head; - if (libc.ofl_head) libc.ofl_head->prev = f; - libc.ofl_head = f; - } + if (!libc.threaded) f->lock = -1; + + OFLLOCK(); + f->next = libc.ofl_head; + if (libc.ofl_head) libc.ofl_head->prev = f; + libc.ofl_head = f; + OFLUNLOCK(); return f; }