From: Rich Felker Date: Fri, 25 Mar 2011 02:58:21 +0000 (-0400) Subject: fix non-atomicity of puts X-Git-Tag: v0.7.5~45 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=8ae2fa65636b732e04e19b2521edc335867ba53b;p=oweals%2Fmusl.git fix non-atomicity of puts --- diff --git a/src/stdio/puts.c b/src/stdio/puts.c index eb70efdc..4c0e583c 100644 --- a/src/stdio/puts.c +++ b/src/stdio/puts.c @@ -2,5 +2,9 @@ int puts(const char *s) { - return -(fputs(s, stdout) < 0 || putchar('\n') < 0); + int r; + FLOCK(stdout); + r = -(fputs(s, stdout) < 0 || putchar('\n') < 0); + FUNLOCK(stdout); + return r; }