summaryrefslogtreecommitdiff
path: root/lib/libc
diff options
context:
space:
mode:
authorasou <asou@cvs.openbsd.org>2019-12-03 05:03:38 +0000
committerasou <asou@cvs.openbsd.org>2019-12-03 05:03:38 +0000
commit0e96480f2712ddeb0fa7eb50548154b20a029a93 (patch)
tree20ed49184349aae00293ad6a8e83e7ac09b8fc14 /lib/libc
parente3d5755f06d8009ef6d20272cf1f122a44308d59 (diff)
fwide() does not unlock if error was occurred.
ok guenther@ and deraadt
Diffstat (limited to 'lib/libc')
-rw-r--r--lib/libc/stdio/fwide.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/libc/stdio/fwide.c b/lib/libc/stdio/fwide.c
index 27ca0f8ac59..4b93d598eab 100644
--- a/lib/libc/stdio/fwide.c
+++ b/lib/libc/stdio/fwide.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: fwide.c,v 1.5 2015/08/31 02:53:57 guenther Exp $ */
+/* $OpenBSD: fwide.c,v 1.6 2019/12/03 05:03:37 asou Exp $ */
/* $NetBSD: fwide.c,v 1.2 2003/01/18 11:29:54 thorpej Exp $ */
/*-
@@ -51,8 +51,10 @@ fwide(FILE *fp, int mode)
FLOCKFILE(fp);
wcio = WCIO_GET(fp);
- if (!wcio)
+ if (!wcio) {
+ FUNLOCKFILE(fp);
return 0; /* XXX */
+ }
if (wcio->wcio_mode == 0 && mode != 0)
wcio->wcio_mode = mode;