e48f3cfbfc
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. |
||
---|---|---|
.. | ||
asprintf.c | ||
clrerr.c | ||
fclose.3 | ||
fclose.c | ||
fdopen.c | ||
feof.c | ||
ferror.3 | ||
ferror.c | ||
fflush.3 | ||
fflush.c | ||
fgetc.c | ||
fgetln.3 | ||
fgetln.c | ||
fgetpos.c | ||
fgets.3 | ||
fgets.c | ||
fileno.c | ||
findfp.c | ||
flags.c | ||
floatio.h | ||
fopen.3 | ||
fopen.c | ||
fprintf.c | ||
fpurge.c | ||
fputc.c | ||
fputs.3 | ||
fputs.c | ||
fread.3 | ||
fread.c | ||
freopen.c | ||
fscanf.c | ||
fseek.3 | ||
fseek.c | ||
fsetpos.c | ||
ftell.c | ||
funopen.3 | ||
funopen.c | ||
fvwrite.c | ||
fvwrite.h | ||
fwalk.c | ||
fwrite.c | ||
getc.3 | ||
getc.c | ||
getchar.c | ||
gets.c | ||
getw.c | ||
glue.h | ||
local.h | ||
makebuf.c | ||
Makefile.inc | ||
mktemp.3 | ||
mktemp.c | ||
perror.c | ||
printf.3 | ||
printf.c | ||
putc.3 | ||
putc.c | ||
putchar.c | ||
puts.c | ||
putw.c | ||
refill.c | ||
remove.3 | ||
remove.c | ||
rewind.c | ||
rget.c | ||
scanf.3 | ||
scanf.c | ||
setbuf.3 | ||
setbuf.c | ||
setbuffer.c | ||
setvbuf.c | ||
snprintf.c | ||
sprintf.c | ||
sscanf.c | ||
stdio.3 | ||
stdio.c | ||
tempnam.c | ||
tmpfile.c | ||
tmpnam.3 | ||
tmpnam.c | ||
ungetc.3 | ||
ungetc.c | ||
vasprintf.c | ||
vfprintf.c | ||
vfscanf.c | ||
vprintf.c | ||
vscanf.c | ||
vsnprintf.c | ||
vsprintf.c | ||
vsscanf.c | ||
wbuf.c | ||
wsetup.c |