Skip to content

Commit

Permalink
lib-fs: If fs-metawrap sees truncated header, it should return error.
Browse files Browse the repository at this point in the history
  • Loading branch information
sirainen committed May 13, 2016
1 parent 6eb0192 commit da653f2
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/lib-fs/istream-metawrap.c
Expand Up @@ -33,8 +33,15 @@ static int metadata_header_read(struct metawrap_istream *mstream)
mstream->callback(line, p, mstream->context);
}
if (mstream->istream.parent->eof) {
mstream->istream.istream.stream_errno =
mstream->istream.parent->stream_errno;
if (mstream->istream.parent->stream_errno != 0) {
mstream->istream.istream.stream_errno =
mstream->istream.parent->stream_errno;
} else {
io_stream_set_error(&mstream->istream.iostream,
"Metadata header is missing ending line");
mstream->istream.istream.stream_errno = EINVAL;
return -1;
}
mstream->istream.istream.eof = TRUE;
return -1;
}
Expand Down

0 comments on commit da653f2

Please sign in to comment.