freebsd-skq/lib/libc/stdio
Peter Wemm e48f3cfbfc Rework previous commit.. I was confused by the number of diffs in the PR
and forgot what I was trying to do originally and accidently zapped
a feature. :-]  The problem is that we are converting a counted buffer in
a malloc pool into a null terminated C-style string.  I was calling realloc
originally to shrink the buffer to the desired size.  If realloc failed, we
still returned the valid buffer - the only thing wrong was it was a tad
too large.  The previous commit disabled this.

This commit now handles the three cases..
1: the buffer is exactly right for the null byte to terminate the
string (we don't call realloc).
2: it's got h.left = 0, so we must expand it to make room. If realloc
fails here, it's fatal.
3: if there's too much room, we realloc to shrink it - a failed realloc
is not fatal, we use the original buffer which is still valid.
1997-07-06 08:42:37 +00:00
..
asprintf.c Revert $FreeBSD$ to $Id$ 1997-02-22 15:12:41 +00:00
clrerr.c Revert $FreeBSD$ to $Id$ 1997-02-22 15:12:41 +00:00
fclose.3
fclose.c Revert $FreeBSD$ to $Id$ 1997-02-22 15:12:41 +00:00
fdopen.c
feof.c Revert $FreeBSD$ to $Id$ 1997-02-22 15:12:41 +00:00
ferror.3
ferror.c Revert $FreeBSD$ to $Id$ 1997-02-22 15:12:41 +00:00
fflush.3
fflush.c Revert $FreeBSD$ to $Id$ 1997-02-22 15:12:41 +00:00
fgetc.c Revert $FreeBSD$ to $Id$ 1997-02-22 15:12:41 +00:00
fgetln.3
fgetln.c Revert $FreeBSD$ to $Id$ 1997-02-22 15:12:41 +00:00
fgetpos.c Revert $FreeBSD$ to $Id$ 1997-02-22 15:12:41 +00:00
fgets.3
fgets.c Revert $FreeBSD$ to $Id$ 1997-02-22 15:12:41 +00:00
fileno.c Revert $FreeBSD$ to $Id$ 1997-02-22 15:12:41 +00:00
findfp.c Revert $FreeBSD$ to $Id$ 1997-02-22 15:12:41 +00:00
flags.c Revert $FreeBSD$ to $Id$ 1997-02-22 15:12:41 +00:00
floatio.h
fopen.3 Fixed #include and/or prototype bugs in synopsis. 1997-04-13 13:35:33 +00:00
fopen.c
fprintf.c Revert $FreeBSD$ to $Id$ 1997-02-22 15:12:41 +00:00
fpurge.c Revert $FreeBSD$ to $Id$ 1997-02-22 15:12:41 +00:00
fputc.c Revert $FreeBSD$ to $Id$ 1997-02-22 15:12:41 +00:00
fputs.3
fputs.c Revert $FreeBSD$ to $Id$ 1997-02-22 15:12:41 +00:00
fread.3
fread.c Revert $FreeBSD$ to $Id$ 1997-02-22 15:12:41 +00:00
freopen.c
fscanf.c Revert $FreeBSD$ to $Id$ 1997-02-22 15:12:41 +00:00
fseek.3 Fixed #include and/or prototype bugs in synopsis. 1997-04-13 13:35:33 +00:00
fseek.c Revert $FreeBSD$ to $Id$ 1997-02-22 15:12:41 +00:00
fsetpos.c Revert $FreeBSD$ to $Id$ 1997-02-22 15:12:41 +00:00
ftell.c Merge from Lite2 1997-03-11 11:40:40 +00:00
funopen.3 Fixed #include and/or prototype bugs in synopsis. 1997-04-13 13:35:33 +00:00
funopen.c
fvwrite.c Revert $FreeBSD$ to $Id$ 1997-02-22 15:12:41 +00:00
fvwrite.h
fwalk.c Revert $FreeBSD$ to $Id$ 1997-02-22 15:12:41 +00:00
fwrite.c Revert $FreeBSD$ to $Id$ 1997-02-22 15:12:41 +00:00
getc.3
getc.c Revert $FreeBSD$ to $Id$ 1997-02-22 15:12:41 +00:00
getchar.c Revert $FreeBSD$ to $Id$ 1997-02-22 15:12:41 +00:00
gets.c Revert $FreeBSD$ to $Id$ 1997-02-22 15:12:41 +00:00
getw.c Revert $FreeBSD$ to $Id$ 1997-02-22 15:12:41 +00:00
glue.h
local.h Import CSRG 4.4BSD-Lite2 lib/libc onto vendor branch 1997-03-11 11:29:42 +00:00
makebuf.c
Makefile.inc Changed all paths to be relative to src/lib instead of src/lib/libc 1997-05-03 03:50:06 +00:00
mktemp.3
mktemp.c Fix race 1997-04-07 18:01:10 +00:00
perror.c
printf.3 FIxed arg types (mostly missing consts) in synopsis. 1997-03-19 00:52:58 +00:00
printf.c Revert $FreeBSD$ to $Id$ 1997-02-22 15:12:41 +00:00
putc.3
putc.c Revert $FreeBSD$ to $Id$ 1997-02-22 15:12:41 +00:00
putchar.c Revert $FreeBSD$ to $Id$ 1997-02-22 15:12:41 +00:00
puts.c Revert $FreeBSD$ to $Id$ 1997-02-22 15:12:41 +00:00
putw.c Revert $FreeBSD$ to $Id$ 1997-02-22 15:12:41 +00:00
refill.c Revert $FreeBSD$ to $Id$ 1997-02-22 15:12:41 +00:00
remove.3
remove.c Revert $FreeBSD$ to $Id$ 1997-02-22 15:12:41 +00:00
rewind.c Revert $FreeBSD$ to $Id$ 1997-02-22 15:12:41 +00:00
rget.c
scanf.3 Add 64 bit int support to scanf() 1997-07-01 17:46:39 +00:00
scanf.c Revert $FreeBSD$ to $Id$ 1997-02-22 15:12:41 +00:00
setbuf.3 Fixed #include and/or prototype bugs in synopsis. 1997-04-13 13:35:33 +00:00
setbuf.c
setbuffer.c Revert $FreeBSD$ to $Id$ 1997-02-22 15:12:41 +00:00
setvbuf.c Revert $FreeBSD$ to $Id$ 1997-02-22 15:12:41 +00:00
snprintf.c Revert $FreeBSD$ to $Id$ 1997-02-22 15:12:41 +00:00
sprintf.c Revert $FreeBSD$ to $Id$ 1997-02-22 15:12:41 +00:00
sscanf.c Revert $FreeBSD$ to $Id$ 1997-02-22 15:12:41 +00:00
stdio.3
stdio.c Revert $FreeBSD$ to $Id$ 1997-02-22 15:12:41 +00:00
tempnam.c Revert $FreeBSD$ to $Id$ 1997-02-22 15:12:41 +00:00
tmpfile.c
tmpnam.3
tmpnam.c
ungetc.3
ungetc.c Revert $FreeBSD$ to $Id$ 1997-02-22 15:12:41 +00:00
vasprintf.c Rework previous commit.. I was confused by the number of diffs in the PR 1997-07-06 08:42:37 +00:00
vfprintf.c Revert $FreeBSD$ to $Id$ 1997-02-22 15:12:41 +00:00
vfscanf.c Add 64 bit int support to scanf() 1997-07-01 17:46:39 +00:00
vprintf.c Revert $FreeBSD$ to $Id$ 1997-02-22 15:12:41 +00:00
vscanf.c Revert $FreeBSD$ to $Id$ 1997-02-22 15:12:41 +00:00
vsnprintf.c Revert $FreeBSD$ to $Id$ 1997-02-22 15:12:41 +00:00
vsprintf.c Revert $FreeBSD$ to $Id$ 1997-02-22 15:12:41 +00:00
vsscanf.c Revert $FreeBSD$ to $Id$ 1997-02-22 15:12:41 +00:00
wbuf.c Revert $FreeBSD$ to $Id$ 1997-02-22 15:12:41 +00:00
wsetup.c Revert $FreeBSD$ to $Id$ 1997-02-22 15:12:41 +00:00