提交 8ae2fa65 编写于 作者: R Rich Felker

fix non-atomicity of puts

上级 b470030f
...@@ -2,5 +2,9 @@ ...@@ -2,5 +2,9 @@
int puts(const char *s) 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;
} }
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册