]> git.ipfire.org Git - thirdparty/zstd.git/commit
fix --list on truncated files 1499/head
authorKarl Ostmo <kostmo@fb.com>
Tue, 15 Jan 2019 01:58:46 +0000 (17:58 -0800)
committerKarl Ostmo <kostmo@fb.com>
Wed, 16 Jan 2019 03:03:29 +0000 (19:03 -0800)
commit4fa585aee375867c99787467a0258fe10a3d4bd5
tree0ef7169ca7fd365ce3011b40a14b55609240d877
parentf8745ae0954b7e4f16a32dcc345a2cb4a77033e2
fix --list on truncated files

fseek() doesn't indicate when it moves past the end of a file.
Consequently, if a file is truncated within its last block, the error would't be detected.

This PR adds a test scenario that induces this situation using a small compressed file of only one block in size.
This test is added to tests/playTests.sh

Check is implemented by ensuring that the filehandle position is equal to the filesize upon exit.
programs/fileio.c
tests/playTests.sh