fix non-atomicity of puts

This commit is contained in:
Rich Felker 2011-03-24 22:58:21 -04:00
parent b470030f83
commit 8ae2fa6563

View File

@ -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;
}