summaryrefslogtreecommitdiff
path: root/lib/libc/stdio/fputs.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/libc/stdio/fputs.c')
-rw-r--r--lib/libc/stdio/fputs.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/lib/libc/stdio/fputs.c b/lib/libc/stdio/fputs.c
index 2ba0d4d1..ac5261e7 100644
--- a/lib/libc/stdio/fputs.c
+++ b/lib/libc/stdio/fputs.c
@@ -1,7 +1,12 @@
-#include <stdio.h> // for fwrite, EOF, FILE, fputs
-#include <string.h> // for strlen
+#include <stdio.h>
int fputs(const char *restrict s, FILE *restrict stream)
{
- return fwrite(s, 1, strlen(s), stream) == strlen(s) ? 0 : EOF;
+ int r;
+
+ flockfile(stream);
+ r = fputs_unlocked(s, stream);
+ funlockfile(stream);
+
+ return r;
}