diff options
author | David Sterba <dsterba@suse.com> | 2016-11-29 16:07:19 +0100 |
---|---|---|
committer | David Sterba <dsterba@suse.com> | 2016-11-30 12:42:22 +0100 |
commit | 71f220034d0ae99d398423ab27e78847e5c02f09 (patch) | |
tree | 08a131084c457ac1248dad10a0e8d5c823fdc9c4 /send-stream.c | |
parent | d960f81d8e1772dd5c0044e80eb5664b9fbf7c72 (diff) |
btrfs-progs: receive: properly detect end of stream conditions
Read buffer helper mistakenly reported end of data as an error. Next, we
have to check if the first stream exists as an empty file is not a valid
stream.
Reported-by: Tsutomu Itoh <t-itoh@jp.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'send-stream.c')
-rw-r--r-- | send-stream.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/send-stream.c b/send-stream.c index 920c7420..5a028cd9 100644 --- a/send-stream.c +++ b/send-stream.c @@ -74,7 +74,7 @@ static int read_buf(struct btrfs_send_stream *sctx, char *buf, size_t len) ret = 0; out_eof: - if (pos < len) { + if (0 < pos && pos < len) { error("short read from stream: expected %zu read %zu", len, pos); ret = -EIO; } else { |