aboutsummaryrefslogtreecommitdiff
path: root/buffered_file.c
diff options
context:
space:
mode:
Diffstat (limited to 'buffered_file.c')
-rw-r--r--buffered_file.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/buffered_file.c b/buffered_file.c
index 1836e7e242..8435a31946 100644
--- a/buffered_file.c
+++ b/buffered_file.c
@@ -206,20 +206,23 @@ static int buffered_rate_limit(void *opaque)
return 0;
}
-static size_t buffered_set_rate_limit(void *opaque, size_t new_rate)
+static int64_t buffered_set_rate_limit(void *opaque, int64_t new_rate)
{
QEMUFileBuffered *s = opaque;
-
if (s->has_error)
goto out;
+ if (new_rate > SIZE_MAX) {
+ new_rate = SIZE_MAX;
+ }
+
s->xfer_limit = new_rate / 10;
out:
return s->xfer_limit;
}
-static size_t buffered_get_rate_limit(void *opaque)
+static int64_t buffered_get_rate_limit(void *opaque)
{
QEMUFileBuffered *s = opaque;