stream abstraction skip past them.master
@@ -595,6 +595,12 @@ again: | |||||
if (truncate(path, tp->files[i].length) != 0) | if (truncate(path, tp->files[i].length) != 0) | ||||
return errno; | return errno; | ||||
goto again; | goto again; | ||||
} else if (ret[i].size == -1 && tp->files[i].length == 0) { | |||||
int fd; | |||||
errno = vopen(&fd, O_CREAT|O_RDWR, "%s", path); | |||||
if (errno != 0 || close(fd) != 0) | |||||
return errno; | |||||
goto again; | |||||
} | } | ||||
} | } | ||||
return 0; | return 0; | ||||
@@ -279,7 +279,7 @@ mi_test_files(const char *files) | |||||
int pcount = 0; | int pcount = 0; | ||||
if (!benc_isdct(fdct)) | if (!benc_isdct(fdct)) | ||||
return 0; | return 0; | ||||
if (benc_dget_int(fdct, "length") <= 0) | |||||
if (benc_dget_int(fdct, "length") < 0) | |||||
return 0; | return 0; | ||||
if ((plst = benc_dget_lst(fdct, "path")) == NULL) | if ((plst = benc_dget_lst(fdct, "path")) == NULL) | ||||
return 0; | return 0; | ||||
@@ -83,6 +83,8 @@ bts_get(struct bt_stream *bts, off_t off, uint8_t *buf, size_t len) | |||||
boff = 0; | boff = 0; | ||||
while (boff < len) { | while (boff < len) { | ||||
if (bts->fd == -1) { | if (bts->fd == -1) { | ||||
while (bts->files[bts->index].length == 0) | |||||
bts->index++; | |||||
err = bts->fd_cb(bts->files[bts->index].path, | err = bts->fd_cb(bts->files[bts->index].path, | ||||
&bts->fd, bts->fd_arg); | &bts->fd, bts->fd_arg); | ||||
if (err != 0) | 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; | boff = 0; | ||||
while (boff < len) { | while (boff < len) { | ||||
if (bts->fd == -1) { | if (bts->fd == -1) { | ||||
while (bts->files[bts->index].length == 0) | |||||
bts->index++; | |||||
err = bts->fd_cb(bts->files[bts->index].path, | err = bts->fd_cb(bts->files[bts->index].path, | ||||
&bts->fd, bts->fd_arg); | &bts->fd, bts->fd_arg); | ||||
if (err != 0) | if (err != 0) | ||||