summaryrefslogtreecommitdiffstats
path: root/lib/libc/stdio/fgetln.c
diff options
context:
space:
mode:
authorache <ache@FreeBSD.org>2016-08-27 11:07:57 +0000
committerache <ache@FreeBSD.org>2016-08-27 11:07:57 +0000
commit151bfb59482950c55b935a404df11b9d3961fb6c (patch)
tree0f9b8d4be1f5b5dd92e48f35a3d39b5f8f2ccdb9 /lib/libc/stdio/fgetln.c
parentc75c3e9c541aa8bba4dedbbdd694bcb9aafd5e81 (diff)
downloadFreeBSD-src-151bfb59482950c55b935a404df11b9d3961fb6c.zip
FreeBSD-src-151bfb59482950c55b935a404df11b9d3961fb6c.tar.gz
MFC r304607,r304641,r304819,r304811
1) Don't forget to set __SERR on __slbexpand() error. 2) Remove "Fast path" from fgetwc()/fputwc() since it can't detect encoding errors and ignores them all. One of affected encoding example: US-ASCII 3) Original fgetln() from 44lite return success for line tail errors, i.e. partial line, but set __SERR and errno in the same time, which is inconsistent. Now both OpenBSD and NetBSD return failure, i.e. no line and set error indicators for such case, so make our fgetln() and fgetwln() (as its wide version) compatible with the rest of *BSD. PR: 212033
Diffstat (limited to 'lib/libc/stdio/fgetln.c')
-rw-r--r--lib/libc/stdio/fgetln.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/libc/stdio/fgetln.c b/lib/libc/stdio/fgetln.c
index 1509bc8..c8e30ee 100644
--- a/lib/libc/stdio/fgetln.c
+++ b/lib/libc/stdio/fgetln.c
@@ -139,8 +139,11 @@ fgetln(FILE *fp, size_t *lenp)
(void)memcpy((void *)(fp->_lb._base + off), (void *)fp->_p,
len - off);
off = len;
- if (__srefill(fp))
- break; /* EOF or error: return partial line */
+ if (__srefill(fp)) {
+ if (__sfeof(fp))
+ break;
+ goto error;
+ }
if ((p = memchr((void *)fp->_p, '\n', (size_t)fp->_r)) == NULL)
continue;
OpenPOWER on IntegriCloud