Skip to content
Snippets Groups Projects
Commit 5a81de94 authored by David Goulet's avatar David Goulet
Browse files

Handle error code in trees_ostream_send_header()


Properly handle the returned value of o_stream_send() so we make sure
the entire header was sent else error on that.

Reported-by: default avatarTomasz Miąsko <tomasz.miasko@gmail.com>
Signed-off-by: default avatarDavid Goulet <dgoulet@riseup.net>
parent 6838535f
Branches
Tags
No related merge requests found
......@@ -66,10 +66,17 @@ trees_ostream_send_header(struct trees_ostream *sstream)
/* The header here consists of a magic number. */
ssize_t ret = o_stream_send(sstream->ostream.parent, header,
sizeof(header));
if (ret != sizeof(header)) {
o_stream_copy_error_from_parent(&sstream->ostream);
goto err;
}
#ifdef DEBUG_STREAMS
sstream->out_byte_count += sizeof(header);
sstream->out_byte_count += ret;
#endif
return ret;
err:
return -1;
}
static ssize_t
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment