diff options
author | David Sterba <dsterba@suse.com> | 2016-11-02 14:00:07 +0100 |
---|---|---|
committer | David Sterba <dsterba@suse.com> | 2016-11-09 13:47:31 +0100 |
commit | aec1d7fa8bd6606e8d7a032c30e16308662130aa (patch) | |
tree | c79b44d80ff837fbadd182970c27687926176718 | |
parent | 76fc07e3a6cdcb825859d833c83af16a34343f0b (diff) |
btrfs-progs: send: use proper type for read result, and rename the variable
Signed-off-by: David Sterba <dsterba@suse.com>
-rw-r--r-- | cmds-send.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/cmds-send.c b/cmds-send.c index 0608a106..bf1d9733 100644 --- a/cmds-send.c +++ b/cmds-send.c @@ -225,21 +225,22 @@ static void *dump_thread(void *arg_) int ret; struct btrfs_send *s = (struct btrfs_send*)arg_; char buf[SEND_BUFFER_SIZE]; - int readed; while (1) { - readed = read(s->send_fd, buf, sizeof(buf)); - if (readed < 0) { + ssize_t rbytes; + + rbytes = read(s->send_fd, buf, sizeof(buf)); + if (rbytes < 0) { ret = -errno; error("failed to read stream from kernel: %s\n", strerror(-ret)); goto out; } - if (!readed) { + if (!rbytes) { ret = 0; goto out; } - ret = write_buf(s->dump_fd, buf, readed); + ret = write_buf(s->dump_fd, buf, rbytes); if (ret < 0) goto out; } |