X-Git-Url: http://nsz.repo.hu/git/?p=musl;a=blobdiff_plain;f=src%2Fstdio%2Fopen_memstream.c;fp=src%2Fstdio%2Fopen_memstream.c;h=9eafdfbaedce42c1bc86165719638e5e335f822e;hp=c7330abedb26b61b69f204d0f2659cc975b159b1;hb=dc059f03e8277abe3f515f350bd9615416aaa5ef;hpb=65465101ee23447bf30adc3a9ebf817d58f5d956 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; }