diff options
author | Rich Felker <dalias@aerifal.cx> | 2011-03-24 22:58:21 -0400 |
---|---|---|
committer | Rich Felker <dalias@aerifal.cx> | 2011-03-24 22:58:21 -0400 |
commit | 8ae2fa65636b732e04e19b2521edc335867ba53b (patch) | |
tree | 7429156e4c0656230331d3151cd15721d6916892 | |
parent | b470030f839a375e5030ec9d44903ef7581c15a2 (diff) | |
download | musl-8ae2fa65636b732e04e19b2521edc335867ba53b.tar.gz musl-8ae2fa65636b732e04e19b2521edc335867ba53b.tar.xz musl-8ae2fa65636b732e04e19b2521edc335867ba53b.zip |
fix non-atomicity of puts
-rw-r--r-- | src/stdio/puts.c | 6 |
1 files changed, 5 insertions, 1 deletions
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; } |