From 0f30d227497418c6d3bef7d52244407e30454504 Mon Sep 17 00:00:00 2001 From: Kacper Date: Mon, 22 Dec 2025 23:27:56 +0100 Subject: Added c11 threads, fixed some locks and add *_unlocked functions --- lib/libc/stdio/fputs.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'lib/libc/stdio/fputs.c') 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 // for fwrite, EOF, FILE, fputs -#include // for strlen +#include 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; } -- cgit v1.2.3