692a99c012
From: Chris Torek <torek@bsdi.com> Here is a semi-official patch (apply to /usr/src/lib/libc/stdio/fseek.c, rebuild libc, install). The current code fails when the seek: - is optimized, and - is to just past the end of the block currently in the buffer, and - is followed by another seek with no intervening read operation, and - the destination of subsequent seek is within the block left in the buffer (seeking to the beginning of a block does not force a read, so the buffer still contains the previous block) so it is indeed rather obscure. I may have a different `final' fix, as this one `loses' the buffer contents on a seek that goes just past the end of the current block. [Footnote: seeks are optimized only on read-only opens of regular files that are buffered by the file's optimal I/O size. This is what you get with fopen(path, "r") and no call to setvbuf().] Obtained from: [ BSDI mailing list ] |
||
---|---|---|
.. | ||
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 | ||
vfprintf.c | ||
vfscanf.c | ||
vprintf.c | ||
vscanf.c | ||
vsnprintf.c | ||
vsprintf.c | ||
vsscanf.c | ||
wbuf.c | ||
wsetup.c |