about summary refs log tree commit diff
path: root/misc/stream.c
diff options
context:
space:
mode:
authorRichard Nyberg <rnyberg@murmeldjur.se>2006-10-12 14:21:42 +0000
committerRichard Nyberg <rnyberg@murmeldjur.se>2006-10-12 14:21:42 +0000
commit45bf9f2658275c80d75e60e8a767178a6bb63387 (patch)
tree3307d9a374f8ed93583bf0be42dbd6e8f26237db /misc/stream.c
parenta781e02cd892b49de1cb84b3279ce82b503c8396 (diff)
downloadbtpd-45bf9f2658275c80d75e60e8a767178a6bb63387.tar.gz
btpd-45bf9f2658275c80d75e60e8a767178a6bb63387.zip
Allow empty files in torrents. Create them in stat_and_adjust and let the
stream abstraction skip past them.

Diffstat (limited to 'misc/stream.c')
-rw-r--r--misc/stream.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/misc/stream.c b/misc/stream.c
index 6f9492e..32a2512 100644
--- a/misc/stream.c
+++ b/misc/stream.c
@@ -83,6 +83,8 @@ bts_get(struct bt_stream *bts, off_t off, uint8_t *buf, size_t len)
     boff = 0;
     while (boff < len) {
         if (bts->fd == -1) {
+            while (bts->files[bts->index].length == 0)
+                bts->index++;
             err = bts->fd_cb(bts->files[bts->index].path,
                 &bts->fd, bts->fd_arg);
             if (err != 0)
@@ -125,6 +127,8 @@ bts_put(struct bt_stream *bts, off_t off, const uint8_t *buf, size_t len)
     boff = 0;
     while (boff < len) {
         if (bts->fd == -1) {
+            while (bts->files[bts->index].length == 0)
+                bts->index++;
             err = bts->fd_cb(bts->files[bts->index].path,
                 &bts->fd, bts->fd_arg);
             if (err != 0)