summaryrefslogtreecommitdiffstats
path: root/lib/libc/stdio/fputws.c
diff options
context:
space:
mode:
authortjr <tjr@FreeBSD.org>2002-09-20 13:25:40 +0000
committertjr <tjr@FreeBSD.org>2002-09-20 13:25:40 +0000
commitdbed35f0682712f2e168f49a242e96a8686105d5 (patch)
tree29ca5fb47314e22cb303f3692525157b85b73387 /lib/libc/stdio/fputws.c
parentff2a681918f0536be0bd28669d15a78b8d1ed571 (diff)
downloadFreeBSD-src-dbed35f0682712f2e168f49a242e96a8686105d5.zip
FreeBSD-src-dbed35f0682712f2e168f49a242e96a8686105d5.tar.gz
Lock the file once per call and use the unlocked fgetwc()/fputwc() variants.
Diffstat (limited to 'lib/libc/stdio/fputws.c')
-rw-r--r--lib/libc/stdio/fputws.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/lib/libc/stdio/fputws.c b/lib/libc/stdio/fputws.c
index 254b4f9..467f098 100644
--- a/lib/libc/stdio/fputws.c
+++ b/lib/libc/stdio/fputws.c
@@ -39,12 +39,15 @@ int
fputws(const wchar_t * __restrict ws, FILE * __restrict fp)
{
- ORIENTLOCK(fp, 1);
-
+ FLOCKFILE(fp);
+ ORIENT(fp, 1);
/* XXX Inefficient */
while (*ws != '\0')
- if (fputwc(*ws++, fp) == WEOF)
+ if (__fputwc(*ws++, fp) == WEOF) {
+ FUNLOCKFILE(fp);
return (-1);
+ }
+ FUNLOCKFILE(fp);
return (0);
}
OpenPOWER on IntegriCloud