]> git.ipfire.org Git - thirdparty/ccache.git/commit
Fix Util::read_file truncating files if size_hint is an underestimate (#808)
authorNicholas Hutchinson <nshutchinson@gmail.com>
Wed, 24 Feb 2021 19:32:20 +0000 (19:32 +0000)
committerGitHub <noreply@github.com>
Wed, 24 Feb 2021 19:32:20 +0000 (20:32 +0100)
commit577656afb5f4a0ccdebe24409fa15b2ea60a3f58
treef23f570a4e5c3d3ad25df15a9d5fd35770a1b887
parent3ba967d9e43ddabb15722418bcce9488aec458cb
Fix Util::read_file truncating files if size_hint is an underestimate (#808)

If the size_hint passed to read_file was an underestimate, or the
platform's `stat()` implementation gives an inaccurate file size (e.g.
MinGW) then `Util::read_file()` would only issue a single `read()` call
instead of reading the entire file.

Fixes #803.
src/Util.cpp
unittest/test_Util.cpp