lib/scanner: Recheck file size and modification time after hashing (ref #3440)
To catch the case where the file changed. Also make sure we never let a size-vs-blocklist mismatch slip through. GitHub-Pull-Request: https://github.com/syncthing/syncthing/pull/3443
This commit is contained in:
@@ -29,7 +29,7 @@ func Blocks(r io.Reader, blocksize int, sizehint int64, counter Counter) ([]prot
|
||||
var blocks []protocol.BlockInfo
|
||||
var hashes, thisHash []byte
|
||||
|
||||
if sizehint > 0 {
|
||||
if sizehint >= 0 {
|
||||
// Allocate contiguous blocks for the BlockInfo structures and their
|
||||
// hashes once and for all, and stick to the specified size.
|
||||
r = io.LimitReader(r, sizehint)
|
||||
|
||||
Reference in New Issue
Block a user