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:
@@ -148,7 +148,7 @@ func TestVerify(t *testing.T) {
|
||||
progress := newByteCounter()
|
||||
defer progress.Close()
|
||||
|
||||
blocks, err := Blocks(buf, blocksize, 0, progress)
|
||||
blocks, err := Blocks(buf, blocksize, -1, progress)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
@@ -380,7 +380,7 @@ func BenchmarkHashFile(b *testing.B) {
|
||||
b.ResetTimer()
|
||||
|
||||
for i := 0; i < b.N; i++ {
|
||||
if _, err := HashFile(testdataName, protocol.BlockSize, testdataSize, nil); err != nil {
|
||||
if _, err := HashFile(testdataName, protocol.BlockSize, nil); err != nil {
|
||||
b.Fatal(err)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user