mirror of
git://git.musl-libc.org/musl
synced 2025-03-06 20:48:29 +01:00
fix non-atomicity of puts
This commit is contained in:
parent
b470030f83
commit
8ae2fa6563
1 changed files with 5 additions and 1 deletions
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue