View | Details | Raw Unified | Return to bug 212033
Collapse All | Expand All

(-)stdio/fgetwln.c (-1 / +1 lines)
Lines 59-81 fgetwln(FILE * __restrict fp, size_t *le Link Here
59
59
60
	len = 0;
60
	len = 0;
61
	while ((wc = __fgetwc_unlock(fp)) != WEOF) {
61
	while ((wc = __fgetwc_unlock(fp)) != WEOF) {
62
#define	GROW	512
62
#define	GROW	512
63
		if (len >= fp->_lb._size / sizeof(wchar_t) &&
63
		if (len >= fp->_lb._size / sizeof(wchar_t) &&
64
		    __slbexpand(fp, len + GROW))
64
		    __slbexpand(fp, len + GROW))
65
			goto error;
65
			goto error;
66
		*((wchar_t *)fp->_lb._base + len++) = wc;
66
		*((wchar_t *)fp->_lb._base + len++) = wc;
67
		if (wc == L'\n')
67
		if (wc == L'\n')
68
			break;
68
			break;
69
	}
69
	}
70
	if (len == 0)
70
	if (len == 0 || fp->_flags & __SERR)
71
		goto error;
71
		goto error;
72
72
73
	FUNLOCKFILE(fp);
73
	FUNLOCKFILE(fp);
74
	*lenp = len;
74
	*lenp = len;
75
	return (wchar_t *)fp->_lb._base;
75
	return (wchar_t *)fp->_lb._base;
76
76
77
error:
77
error:
78
	FUNLOCKFILE(fp);
78
	FUNLOCKFILE(fp);
79
	*lenp = 0;
79
	*lenp = 0;
80
	return NULL;
80
	return NULL;
81
}
81
}

Return to bug 212033