freebsd-dev/lib/libc/stdio
Bryan Drewery 8f8a794775 getdelim(3): Fix losing data on [EAGAIN]
Currently when an [EAGAIN] is encountered we return a partial result
that does not contain the delimeter.  On the next (successful) read we
were returning the next part of the line without the preceding string
from the first failed call.

Fix this by using the same mechanism as ungetc(3) does.  For the buffered
case we could simply set fp->_r and fp->_p back to their values before
sappend() is ran but for simplicity ungetc(3) is done in there as well.

Reviewed by:	kib
Differential Revision: https://reviews.freebsd.org/D31687
2021-09-02 11:26:26 -07:00
..
_flock_stub.c General further adoption of SPDX licensing ID tags. 2017-11-20 19:49:47 +00:00
asprintf.c General further adoption of SPDX licensing ID tags. 2017-11-20 19:49:47 +00:00
clrerr.c General further adoption of SPDX licensing ID tags. 2017-11-20 19:49:47 +00:00
dprintf.c libc: further adoption of SPDX licensing ID tags. 2017-11-25 17:12:48 +00:00
fclose.3 Renumber copyright clause 4 2017-02-28 23:42:47 +00:00
fclose.c General further adoption of SPDX licensing ID tags. 2017-11-20 19:49:47 +00:00
fcloseall.c libc: further adoption of SPDX licensing ID tags. 2017-11-25 17:12:48 +00:00
fdopen.c General further adoption of SPDX licensing ID tags. 2017-11-20 19:49:47 +00:00
feof.c General further adoption of SPDX licensing ID tags. 2017-11-20 19:49:47 +00:00
ferror.3 Renumber copyright clause 4 2017-02-28 23:42:47 +00:00
ferror.c General further adoption of SPDX licensing ID tags. 2017-11-20 19:49:47 +00:00
fflush.3 libc manpages: various improvements from NetBSD 2020-06-14 05:59:30 +00:00
fflush.c stdio: provide _unlocked variants of fflush, fputc, fputs, fread, fwrite 2020-01-30 03:31:16 +00:00
fgetc.c General further adoption of SPDX licensing ID tags. 2017-11-20 19:49:47 +00:00
fgetln.3 fgetln(3): Add a Caveats Section 2020-06-18 13:13:04 +00:00
fgetln.c GC a historical artifact. 2019-02-07 23:17:44 +00:00
fgetpos.c General further adoption of SPDX licensing ID tags. 2017-11-20 19:49:47 +00:00
fgets.3 libc: remove gets 2019-09-01 16:12:05 +00:00
fgets.c General further adoption of SPDX licensing ID tags. 2017-11-20 19:49:47 +00:00
fgetwc.c libc: further adoption of SPDX licensing ID tags. 2017-11-25 17:12:48 +00:00
fgetwln.3 Renumber copyright clause 4 2017-02-28 23:42:47 +00:00
fgetwln.c libc: further adoption of SPDX licensing ID tags. 2017-11-25 17:12:48 +00:00
fgetws.3 Renumber copyright clause 4 2017-02-28 23:42:47 +00:00
fgetws.c libc: further adoption of SPDX licensing ID tags. 2017-11-25 17:12:48 +00:00
fileno.c General further adoption of SPDX licensing ID tags. 2017-11-20 19:49:47 +00:00
findfp.c General further adoption of SPDX licensing ID tags. 2017-11-20 19:49:47 +00:00
flags.c General further adoption of SPDX licensing ID tags. 2017-11-20 19:49:47 +00:00
floatio.h General further adoption of SPDX licensing ID tags. 2017-11-20 19:49:47 +00:00
flockfile.3
fmemopen.c libc: further adoption of SPDX licensing ID tags. 2017-11-25 17:12:48 +00:00
fopen.3 libc manpages: various improvements from NetBSD 2020-06-14 05:59:30 +00:00
fopen.c General further adoption of SPDX licensing ID tags. 2017-11-20 19:49:47 +00:00
fopencookie.3 fopencookie(3): declare function pointers in SYNOPSIS correctly 2017-05-23 07:15:57 +00:00
fopencookie.c libc: Add fopencookie(3) wrapper around funopen(3) 2016-05-11 14:38:27 +00:00
fprintf.c General further adoption of SPDX licensing ID tags. 2017-11-20 19:49:47 +00:00
fpurge.c General further adoption of SPDX licensing ID tags. 2017-11-20 19:49:47 +00:00
fputc.c libc: provide fputc_unlocked 2020-02-02 19:45:12 +00:00
fputs.3 stdio: provide _unlocked variants of fflush, fputc, fputs, fread, fwrite 2020-01-30 03:31:16 +00:00
fputs.c stdio: provide _unlocked variants of fflush, fputc, fputs, fread, fwrite 2020-01-30 03:31:16 +00:00
fputwc.c libc: further adoption of SPDX licensing ID tags. 2017-11-25 17:12:48 +00:00
fputws.3 Renumber copyright clause 4 2017-02-28 23:42:47 +00:00
fputws.c libc: further adoption of SPDX licensing ID tags. 2017-11-25 17:12:48 +00:00
fread.3 stdio: provide _unlocked variants of fflush, fputc, fputs, fread, fwrite 2020-01-30 03:31:16 +00:00
fread.c fread: improve performance for unbuffered reads 2021-06-01 16:00:28 -05:00
freopen.c General further adoption of SPDX licensing ID tags. 2017-11-20 19:49:47 +00:00
fscanf.c General further adoption of SPDX licensing ID tags. 2017-11-20 19:49:47 +00:00
fseek.3 Renumber copyright clause 4 2017-02-28 23:42:47 +00:00
fseek.c General further adoption of SPDX licensing ID tags. 2017-11-20 19:49:47 +00:00
fsetpos.c General further adoption of SPDX licensing ID tags. 2017-11-20 19:49:47 +00:00
ftell.c General further adoption of SPDX licensing ID tags. 2017-11-20 19:49:47 +00:00
funopen.3 Renumber copyright clause 4 2017-02-28 23:42:47 +00:00
funopen.c General further adoption of SPDX licensing ID tags. 2017-11-20 19:49:47 +00:00
fvwrite.c General further adoption of SPDX licensing ID tags. 2017-11-20 19:49:47 +00:00
fvwrite.h General further adoption of SPDX licensing ID tags. 2017-11-20 19:49:47 +00:00
fwalk.c General further adoption of SPDX licensing ID tags. 2017-11-20 19:49:47 +00:00
fwide.3
fwide.c libc: further adoption of SPDX licensing ID tags. 2017-11-25 17:12:48 +00:00
fwprintf.c libc: further adoption of SPDX licensing ID tags. 2017-11-25 17:12:48 +00:00
fwrite.c stdio: provide _unlocked variants of fflush, fputc, fputs, fread, fwrite 2020-01-30 03:31:16 +00:00
fwscanf.c libc: further adoption of SPDX licensing ID tags. 2017-11-25 17:12:48 +00:00
getc.3 Add HISTORY section to getc(3) 2020-04-10 09:37:20 +00:00
getc.c General further adoption of SPDX licensing ID tags. 2017-11-20 19:49:47 +00:00
getchar.c General further adoption of SPDX licensing ID tags. 2017-11-20 19:49:47 +00:00
getdelim.c getdelim(3): Fix losing data on [EAGAIN] 2021-09-02 11:26:26 -07:00
getline.3 Remove _WITH_GETLINE and _WITH_DPRINTF guards 2016-07-30 01:00:16 +00:00
getline.c libc: further adoption of SPDX licensing ID tags. 2017-11-25 17:12:48 +00:00
gets_s.c Conform to Berne Convention. 2018-05-19 21:26:07 +00:00
gets.c libc: remove gets 2019-09-01 16:12:05 +00:00
getw.c General further adoption of SPDX licensing ID tags. 2017-11-20 19:49:47 +00:00
getwc.3 Note some functions that appeared in First Edition Unix 2020-04-01 22:50:41 +00:00
getwc.c libc: further adoption of SPDX licensing ID tags. 2017-11-25 17:12:48 +00:00
getwchar.c libc: further adoption of SPDX licensing ID tags. 2017-11-25 17:12:48 +00:00
glue.h General further adoption of SPDX licensing ID tags. 2017-11-20 19:49:47 +00:00
local.h General further adoption of SPDX licensing ID tags. 2017-11-20 19:49:47 +00:00
makebuf.c General further adoption of SPDX licensing ID tags. 2017-11-20 19:49:47 +00:00
Makefile.inc stdio: provide _unlocked variants of fflush, fputc, fputs, fread, fwrite 2020-01-30 03:31:16 +00:00
mktemp.3 Add mkostempsat(3). 2019-07-29 19:02:16 +00:00
mktemp.c libc: try to skip memcpy in _gettemp 2021-01-24 11:06:36 +00:00
open_memstream.3 open_memstream(3): fix typo 2021-04-28 12:18:25 +03:00
open_memstream.c libc: further adoption of SPDX licensing ID tags. 2017-11-25 17:12:48 +00:00
open_wmemstream.c libc: further adoption of SPDX licensing ID tags. 2017-11-25 17:12:48 +00:00
perror.c General further adoption of SPDX licensing ID tags. 2017-11-20 19:49:47 +00:00
printf_l.3
printf-pos.c General further adoption of SPDX licensing ID tags. 2017-11-20 19:49:47 +00:00
printf.3 Implement printf(3) family %m format string extension. 2018-05-22 11:05:40 +00:00
printf.c General further adoption of SPDX licensing ID tags. 2017-11-20 19:49:47 +00:00
printfcommon.h General further adoption of SPDX licensing ID tags. 2017-11-20 19:49:47 +00:00
printflocal.h General further adoption of SPDX licensing ID tags. 2017-11-20 19:49:47 +00:00
putc.3 stdio: provide _unlocked variants of fflush, fputc, fputs, fread, fwrite 2020-01-30 03:31:16 +00:00
putc.c General further adoption of SPDX licensing ID tags. 2017-11-20 19:49:47 +00:00
putchar.c General further adoption of SPDX licensing ID tags. 2017-11-20 19:49:47 +00:00
puts.c General further adoption of SPDX licensing ID tags. 2017-11-20 19:49:47 +00:00
putw.c General further adoption of SPDX licensing ID tags. 2017-11-20 19:49:47 +00:00
putwc.3 Renumber copyright clause 4 2017-02-28 23:42:47 +00:00
putwc.c libc: further adoption of SPDX licensing ID tags. 2017-11-25 17:12:48 +00:00
putwchar.c libc: further adoption of SPDX licensing ID tags. 2017-11-25 17:12:48 +00:00
refill.c General further adoption of SPDX licensing ID tags. 2017-11-20 19:49:47 +00:00
remove.3 Renumber copyright clause 4 2017-02-28 23:42:47 +00:00
remove.c General further adoption of SPDX licensing ID tags. 2017-11-20 19:49:47 +00:00
rewind.c General further adoption of SPDX licensing ID tags. 2017-11-20 19:49:47 +00:00
rget.c General further adoption of SPDX licensing ID tags. 2017-11-20 19:49:47 +00:00
scanf_l.3
scanf.3 Renumber copyright clause 4 2017-02-28 23:42:47 +00:00
scanf.c General further adoption of SPDX licensing ID tags. 2017-11-20 19:49:47 +00:00
setbuf.3 libc manpages: various improvements from NetBSD 2020-06-14 05:59:30 +00:00
setbuf.c General further adoption of SPDX licensing ID tags. 2017-11-20 19:49:47 +00:00
setbuffer.c General further adoption of SPDX licensing ID tags. 2017-11-20 19:49:47 +00:00
setvbuf.c General further adoption of SPDX licensing ID tags. 2017-11-20 19:49:47 +00:00
snprintf.c General further adoption of SPDX licensing ID tags. 2017-11-20 19:49:47 +00:00
sprintf.c General further adoption of SPDX licensing ID tags. 2017-11-20 19:49:47 +00:00
sscanf.c General further adoption of SPDX licensing ID tags. 2017-11-20 19:49:47 +00:00
stdio.3 libc: remove gets 2019-09-01 16:12:05 +00:00
stdio.c General further adoption of SPDX licensing ID tags. 2017-11-20 19:49:47 +00:00
swprintf.c libc: further adoption of SPDX licensing ID tags. 2017-11-25 17:12:48 +00:00
swscanf.c libc: further adoption of SPDX licensing ID tags. 2017-11-25 17:12:48 +00:00
Symbol.map libc: provide fputc_unlocked 2020-02-02 19:45:12 +00:00
tempnam.c General further adoption of SPDX licensing ID tags. 2017-11-20 19:49:47 +00:00
tmpfile.c General further adoption of SPDX licensing ID tags. 2017-11-20 19:49:47 +00:00
tmpnam.3 tmpnam(3): Also mention tmpfile in the ENVIRONMENT section 2020-08-07 16:20:07 +00:00
tmpnam.c General further adoption of SPDX licensing ID tags. 2017-11-20 19:49:47 +00:00
ungetc.3 Renumber copyright clause 4 2017-02-28 23:42:47 +00:00
ungetc.c General further adoption of SPDX licensing ID tags. 2017-11-20 19:49:47 +00:00
ungetwc.3 Renumber copyright clause 4 2017-02-28 23:42:47 +00:00
ungetwc.c libc: further adoption of SPDX licensing ID tags. 2017-11-25 17:12:48 +00:00
vasprintf.c libc: further adoption of SPDX licensing ID tags. 2017-11-25 17:12:48 +00:00
vdprintf.c libc: further adoption of SPDX licensing ID tags. 2017-11-25 17:12:48 +00:00
vfprintf.c Implement printf(3) family %m format string extension. 2018-05-22 11:05:40 +00:00
vfscanf.c General further adoption of SPDX licensing ID tags. 2017-11-20 19:49:47 +00:00
vfwprintf.c General further adoption of SPDX licensing ID tags. 2017-11-20 19:49:47 +00:00
vfwscanf.c The function fwscanf() return value is wrong when encountering an early 2017-12-06 21:12:24 +00:00
vprintf.c General further adoption of SPDX licensing ID tags. 2017-11-20 19:49:47 +00:00
vscanf.c General further adoption of SPDX licensing ID tags. 2017-11-20 19:49:47 +00:00
vsnprintf.c General further adoption of SPDX licensing ID tags. 2017-11-20 19:49:47 +00:00
vsprintf.c General further adoption of SPDX licensing ID tags. 2017-11-20 19:49:47 +00:00
vsscanf.c General further adoption of SPDX licensing ID tags. 2017-11-20 19:49:47 +00:00
vswprintf.c libc: further adoption of SPDX licensing ID tags. 2017-11-25 17:12:48 +00:00
vswscanf.c General further adoption of SPDX licensing ID tags. 2017-11-20 19:49:47 +00:00
vwprintf.c libc: further adoption of SPDX licensing ID tags. 2017-11-25 17:12:48 +00:00
vwscanf.c libc: further adoption of SPDX licensing ID tags. 2017-11-25 17:12:48 +00:00
wbuf.c General further adoption of SPDX licensing ID tags. 2017-11-20 19:49:47 +00:00
wprintf.3 Renumber copyright clause 4 2017-02-28 23:42:47 +00:00
wprintf.c libc: further adoption of SPDX licensing ID tags. 2017-11-25 17:12:48 +00:00
wscanf.3 Renumber copyright clause 4 2017-02-28 23:42:47 +00:00
wscanf.c libc: further adoption of SPDX licensing ID tags. 2017-11-25 17:12:48 +00:00
wsetup.c General further adoption of SPDX licensing ID tags. 2017-11-20 19:49:47 +00:00
xprintf_errno.c libc: further adoption of SPDX licensing ID tags. 2017-11-25 17:12:48 +00:00
xprintf_float.c General further adoption of SPDX licensing ID tags. 2017-11-20 19:49:47 +00:00
xprintf_hexdump.c Truncate negative lengths to zero 2017-11-27 09:57:37 +00:00
xprintf_int.c __printf_render_int(): small type change to match use. 2018-02-23 01:11:57 +00:00
xprintf_quote.c libc: further adoption of SPDX licensing ID tags. 2017-11-25 17:12:48 +00:00
xprintf_str.c General further adoption of SPDX licensing ID tags. 2017-11-20 19:49:47 +00:00
xprintf_time.c General further adoption of SPDX licensing ID tags. 2017-11-20 19:49:47 +00:00
xprintf_vis.c libc: further adoption of SPDX licensing ID tags. 2017-11-25 17:12:48 +00:00
xprintf.c General further adoption of SPDX licensing ID tags. 2017-11-20 19:49:47 +00:00