summaryrefslogtreecommitdiff
path: root/cmds-send.c
diff options
context:
space:
mode:
authorDavid Sterba <dsterba@suse.com>2016-11-02 14:04:06 +0100
committerDavid Sterba <dsterba@suse.com>2016-11-09 13:47:31 +0100
commitf3a00c630a8f3b4ca41727e4b05fef507fc0cf0f (patch)
treebfcc1f1ed4a4ceeb4e9f4b7d964b20cad6dc4b6f /cmds-send.c
parentaec1d7fa8bd6606e8d7a032c30e16308662130aa (diff)
btrfs-progs: send: clean types in write_buf
Use matching types for buffer, return value and buffer sizes. Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'cmds-send.c')
-rw-r--r--cmds-send.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/cmds-send.c b/cmds-send.c
index bf1d9733..5fe87899 100644
--- a/cmds-send.c
+++ b/cmds-send.c
@@ -195,24 +195,26 @@ static int add_clone_source(struct btrfs_send *s, u64 root_id)
return 0;
}
-static int write_buf(int fd, const void *buf, int size)
+static int write_buf(int fd, const char *buf, size_t size)
{
int ret;
- int pos = 0;
+ size_t pos = 0;
while (pos < size) {
- ret = write(fd, (char*)buf + pos, size - pos);
- if (ret < 0) {
+ ssize_t wbytes;
+
+ wbytes = write(fd, buf + pos, size - pos);
+ if (wbytes < 0) {
ret = -errno;
error("failed to dump stream: %s", strerror(-ret));
goto out;
}
- if (!ret) {
+ if (!wbytes) {
ret = -EIO;
error("failed to dump stream: %s", strerror(-ret));
goto out;
}
- pos += ret;
+ pos += wbytes;
}
ret = 0;