fix r2531 bug reported by Lacrocivious

This commit is contained in:
Charles Kerr 2007-07-28 16:31:08 +00:00
parent 29367fda62
commit 530507760b
1 changed files with 6 additions and 1 deletions

View File

@ -219,8 +219,14 @@ torrentRealInit( tr_handle_t * h,
tor->lastPieceSize = info->totalSize % info->pieceSize;
if( !tor->lastPieceSize )
tor->lastPieceSize = info->pieceSize;
tor->lastBlockSize = info->totalSize % tor->blockSize;
if( !tor->lastBlockSize )
tor->lastBlockSize = tor->blockSize;
tor->blockCount =
( info->totalSize + tor->blockSize - 1 ) / tor->blockSize;
@ -231,7 +237,6 @@ torrentRealInit( tr_handle_t * h,
( tor->lastPieceSize + tor->blockSize - 1 ) / tor->blockSize;
/* check our work */
fprintf( stderr, "adding torrent [%s]\n", tor->info.name );
assert( ( info->pieceSize % tor->blockSize ) == 0 );
t = info->pieceCount - 1;
t *= info->pieceSize;