Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- diff --git a/libc/stdio/puts.c b/libc/stdio/puts.c
- index 67775ff..7e2bfd6 100644
- --- a/libc/stdio/puts.c
- +++ b/libc/stdio/puts.c
- @@ -6,8 +6,17 @@
- */
- #include "_stdio.h"
- +#ifdef __UCLIBC_HAS_THREADS__
- +#include "pthreadP.h"
- +static void my_unlock(void *u)
- +{
- + __lll_unlock(u, LLL_PRIVATE);
- +}
- +
- +#endif
- +
- int puts(register const char * __restrict s)
- {
- register FILE *stream = stdout; /* This helps bcc optimize. */
- @@ -21,12 +30,16 @@ int puts(register const char * __restrict s)
- * then we could have a newline in the buffer of an LBF stream. */
- /* Note: Nonportable as fputs need only return nonnegative on success. */
- +
- +
- + pthread_cleanup_push(my_unlock, (&(stream->__lock.lock)));
- if ((n = fputs_unlocked(s, stream)) != EOF) {
- ++n;
- if (__fputc_unlocked('\n', stream) == EOF) {
- n = EOF;
- }
- }
- + pthread_cleanup_pop(0);
- __STDIO_AUTO_THREADUNLOCK(stream);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement