X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;ds=sidebyside;f=src%2Fstdio%2Fopen_memstream.c;h=9eafdfbaedce42c1bc86165719638e5e335f822e;hb=HEAD;hp=c7330abedb26b61b69f204d0f2659cc975b159b1;hpb=835f9f950e2f6059532bd9ab9857a856ed21a4fd;p=musl diff --git a/src/stdio/open_memstream.c b/src/stdio/open_memstream.c index c7330abe..9eafdfba 100644 --- a/src/stdio/open_memstream.c +++ b/src/stdio/open_memstream.c @@ -77,12 +77,13 @@ FILE *open_memstream(char **bufp, size_t *sizep) f->seek = ms_seek; f->close = ms_close; - 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; }