From 7e1f3053e41c8d598f9afd082922c70c09a654e0 Mon Sep 17 00:00:00 2001 From: asou Date: Tue, 3 Dec 2019 05:03:37 +0000 Subject: fwide() does not unlock if error was occurred. ok guenther@ and deraadt --- lib/libc/stdio/fwide.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'lib/libc') 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; -- cgit v1.2.3-59-g8ed1b