From OpenBSD:

bugfix: when fgetwc(3) fails, fgetwln(3) must fail as well;
This commit is contained in:
christos 2016-08-22 06:11:39 +00:00
parent ac5dc9905b
commit a78f4eaca1
1 changed files with 3 additions and 3 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: fgetwln.c,v 1.5 2012/03/15 18:22:30 christos Exp $ */ /* $NetBSD: fgetwln.c,v 1.6 2016/08/22 06:11:39 christos Exp $ */
/*- /*-
* Copyright (c) 2002-2004 Tim J. Robbins. * Copyright (c) 2002-2004 Tim J. Robbins.
@ -31,7 +31,7 @@
#if 0 #if 0
__FBSDID("$FreeBSD: src/lib/libc/stdio/fgetwln.c,v 1.2 2004/08/06 17:00:09 tjr Exp $"); __FBSDID("$FreeBSD: src/lib/libc/stdio/fgetwln.c,v 1.2 2004/08/06 17:00:09 tjr Exp $");
#else #else
__RCSID("$NetBSD: fgetwln.c,v 1.5 2012/03/15 18:22:30 christos Exp $"); __RCSID("$NetBSD: fgetwln.c,v 1.6 2016/08/22 06:11:39 christos Exp $");
#endif #endif
#endif /* LIBC_SCCS and not lint */ #endif /* LIBC_SCCS and not lint */
@ -94,7 +94,7 @@ fgetwln(FILE * __restrict fp, size_t *lenp)
if (wc == L'\n') if (wc == L'\n')
break; break;
} }
if (len == 0) if (len == 0 || fp->flags & __SERR)
goto error; goto error;
FUNLOCKFILE(fp); FUNLOCKFILE(fp);