]> Sergey Matveev's repositories - btrtrc.git/commitdiff
Fix #35
authorMatt Joiner <anacrolix@gmail.com>
Thu, 29 Oct 2015 12:47:13 +0000 (23:47 +1100)
committerMatt Joiner <anacrolix@gmail.com>
Thu, 29 Oct 2015 12:47:13 +0000 (23:47 +1100)
metainfo/builder.go

index 96df1939732165c3d13e9dbcc93ebbbd0aa11bcd..72683bb564fd7d246906b2978d752c102b2d93bf 100644 (file)
@@ -304,7 +304,7 @@ func (b *Batch) Start(w io.Writer, nworkers int) (<-chan error, <-chan int64) {
 
                // prepare files for reading
                fr := files_reader{files: b.files}
-               npieces := b.total_size/b.piece_length + 1
+               npieces := (b.total_size + b.piece_length - 1) / b.piece_length
                b.pieces = make([]byte, 20*npieces)
                hashed := int64(0)