stream: fix a nasty bug that completely messed up with the streambuf

structure tracking. Now when the new streambuf position is exactly at
the end of the previous streambuf, we only fuzz the streambuf if new
data is available (i.e. when streambuf_count != 0); otherwise, it just
means that we’re at the end of the file, waiting for new read orders.
This commit is contained in:
Sam Hocevar
2015-01-20 01:32:51 +01:00
parent 1d0fd3c370
commit 6ccb82a9ff
2 changed files with 40 additions and 19 deletions
+3 -1
View File
@@ -83,8 +83,10 @@ checkutils()
check "$ZZOPTS" "$ZZAT -x \"repeat(-1,__fread_chk(1,1000),feof(1))\" $file" \
"Gentoo __fread_chk() bug regression"
fi
check "$ZZOPTS" "$ZZAT -x \"fread(1,4095) fread(1,1) fseek(0,SEEK_SET) fread(1,33000)\" $file" \
"streambuf end bug regression"
check "$ZZOPTS" "$ZZAT -x \"fread(1,32768) fseek(-100,SEEK_END) fread(1,1) fseek(-1,SEEK_END) fread(1,1) fseek(-100,SEEK_CUR) fread(1,100)\" $file" \
"fread(1) before EOF bug regression"
"streambuf end bug regression"
# Misc tests
for n in \
"fread(1,33000)" \