forked from Mirrors/btrfs-progs
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>master
parent
aec1d7fa8b
commit
f3a00c630a
14
cmds-send.c
14
cmds-send.c
|
@ -195,24 +195,26 @@ static int add_clone_source(struct btrfs_send *s, u64 root_id)
|
||||||
return 0;
|
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 ret;
|
||||||
int pos = 0;
|
size_t pos = 0;
|
||||||
|
|
||||||
while (pos < size) {
|
while (pos < size) {
|
||||||
ret = write(fd, (char*)buf + pos, size - pos);
|
ssize_t wbytes;
|
||||||
if (ret < 0) {
|
|
||||||
|
wbytes = write(fd, buf + pos, size - pos);
|
||||||
|
if (wbytes < 0) {
|
||||||
ret = -errno;
|
ret = -errno;
|
||||||
error("failed to dump stream: %s", strerror(-ret));
|
error("failed to dump stream: %s", strerror(-ret));
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
if (!ret) {
|
if (!wbytes) {
|
||||||
ret = -EIO;
|
ret = -EIO;
|
||||||
error("failed to dump stream: %s", strerror(-ret));
|
error("failed to dump stream: %s", strerror(-ret));
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
pos += ret;
|
pos += wbytes;
|
||||||
}
|
}
|
||||||
ret = 0;
|
ret = 0;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue