summaryrefslogtreecommitdiff
path: root/lib/libc/stdio/fgetwln.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/libc/stdio/fgetwln.c')
-rw-r--r--lib/libc/stdio/fgetwln.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/lib/libc/stdio/fgetwln.c b/lib/libc/stdio/fgetwln.c
index 037657c224b0..a29f1f6bfb3b 100644
--- a/lib/libc/stdio/fgetwln.c
+++ b/lib/libc/stdio/fgetwln.c
@@ -45,13 +45,14 @@ wchar_t *fgetwln_l(FILE * __restrict, size_t *, locale_t);
wchar_t *
fgetwln_l(FILE * __restrict fp, size_t *lenp, locale_t locale)
{
+ wchar_t *ret;
wint_t wc;
size_t len;
int savserr;
FIX_LOCALE(locale);
- FLOCKFILE(fp);
+ FLOCKFILE_CANCELSAFE(fp);
ORIENT(fp, 1);
savserr = fp->_flags & __SERR;
@@ -77,14 +78,16 @@ fgetwln_l(FILE * __restrict fp, size_t *lenp, locale_t locale)
if (len == 0)
goto error;
- FUNLOCKFILE(fp);
*lenp = len;
- return ((wchar_t *)fp->_lb._base);
+ ret = (wchar_t *)fp->_lb._base;
+end:
+ FUNLOCKFILE_CANCELSAFE();
+ return (ret);
error:
- FUNLOCKFILE(fp);
*lenp = 0;
- return (NULL);
+ ret = NULL;
+ goto end;
}
wchar_t *