Skip to content

Commit

Permalink
lib-fs: Allow multiple fs_read_stream() calls to seekable istreams.
Browse files Browse the repository at this point in the history
This fixes for example calling fs_default_copy() for an istream which was
already opened:

Panic: file fs-api.c: line 528 (fs_read_stream): assertion failed: (!file->istream_open)
  • Loading branch information
sirainen committed Apr 28, 2016
1 parent db5d7fb commit 0ed8bcc
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/lib-fs/fs-api.c
Expand Up @@ -555,10 +555,10 @@ struct istream *fs_read_stream(struct fs_file *file, size_t max_buffer_size)
file->fs->temp_path_prefix);
i_stream_set_name(input, i_stream_get_name(inputs[0]));
i_stream_unref(&inputs[0]);

file->seekable_input = input;
i_stream_ref(file->seekable_input);
}
file->seekable_input = input;
i_stream_ref(file->seekable_input);

if ((file->flags & FS_OPEN_FLAG_ASYNC) == 0 && !input->blocking) {
/* read the whole input stream before returning */
while ((ret = i_stream_read_data(input, &data, &size, 0)) >= 0) {
Expand Down

0 comments on commit 0ed8bcc

Please sign in to comment.