mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/kdave/btrfs-progs.git
synced 2024-11-15 08:14:21 +08:00
btrfs-progs: send-stream: use proper type for read return value
Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
parent
2513dfed8f
commit
d13168cebf
@ -43,18 +43,20 @@ static int read_buf(struct btrfs_send_stream *sctx, char *buf, size_t len)
|
||||
size_t pos = 0;
|
||||
|
||||
while (pos < len) {
|
||||
ret = read(sctx->fd, buf + pos, len - pos);
|
||||
if (ret < 0) {
|
||||
ssize_t rbytes;
|
||||
|
||||
rbytes = read(sctx->fd, buf + pos, len - pos);
|
||||
if (rbytes < 0) {
|
||||
ret = -errno;
|
||||
error("read from stream failed: %s",
|
||||
strerror(-ret));
|
||||
goto out;
|
||||
}
|
||||
if (ret == 0) {
|
||||
if (rbytes == 0) {
|
||||
ret = 1;
|
||||
goto out;
|
||||
}
|
||||
pos += ret;
|
||||
pos += rbytes;
|
||||
}
|
||||
|
||||
ret = 0;
|
||||
|
Loading…
Reference in New Issue
Block a user