projects
/
oweals
/
musl.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
b470030
)
fix non-atomicity of puts
author
Rich Felker
<dalias@aerifal.cx>
Fri, 25 Mar 2011 02:58:21 +0000
(22:58 -0400)
committer
Rich Felker
<dalias@aerifal.cx>
Fri, 25 Mar 2011 02:58:21 +0000
(22:58 -0400)
src/stdio/puts.c
patch
|
blob
|
history
diff --git
a/src/stdio/puts.c
b/src/stdio/puts.c
index eb70efdc217bedb99c9db217d96bc706f688d150..4c0e583cfae7cd32e4d896fa9edb12cf14838629 100644
(file)
--- 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;
}