diff options
| author | Richard Nyberg <rnyberg@murmeldjur.se> | 2005-07-30 18:27:46 +0000 |
|---|---|---|
| committer | Richard Nyberg <rnyberg@murmeldjur.se> | 2005-07-30 18:27:46 +0000 |
| commit | 17a1f68906a0d5b9a2db7127327a533d231af393 (patch) | |
| tree | 0d92bce8755b582a8c3460110727067abe1cba87 /cli/btcli.c | |
| parent | af31e76618aa2bef49caa2d6dd9bad7317cb79c6 (diff) | |
| download | btpd-17a1f68906a0d5b9a2db7127327a533d231af393.tar.gz btpd-17a1f68906a0d5b9a2db7127327a533d231af393.zip | |
All files:
Each piece must have at least one byte for their block bit array, or they will collide causing great confusion in btpd. The calculation was done wrong so this could happen for small torrents (blocks / piece < 8). policy_subr.c: * Add test for correctness. * Add missing call to cm_on_piece_full in cm_new_piece.
Diffstat (limited to 'cli/btcli.c')
| -rw-r--r-- | cli/btcli.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/cli/btcli.c b/cli/btcli.c index 874ef6a..6b5d8b1 100644 --- a/cli/btcli.c +++ b/cli/btcli.c @@ -138,9 +138,8 @@ gen_ifile(char *path) if ((errno = vopen(&fd, O_WRONLY|O_CREAT, "%s.i", path)) != 0) err(1, "opening %s.i", path); - if (ftruncate(fd, - field_len + - (off_t)ceil(mi->npieces * mi->piece_length / (double)(1<<17))) < 0) + if (ftruncate(fd, field_len + mi->npieces * + (off_t)ceil(mi->piece_length / (double)(1 << 17))) < 0) err(1, "ftruncate: %s", path); if (write(fd, cb.piece_field, field_len) != field_len) |