Message ID | d011b0bf09828040999e4e57f86d70f9b78e4bcc.1318189535.git.quintela@redhat.com |
---|---|
State | New |
Headers | show |
diff --git a/savevm.c b/savevm.c index 4069b34..94628c6 100644 --- a/savevm.c +++ b/savevm.c @@ -578,17 +578,14 @@ static int qemu_peek_byte(QEMUFile *f) int qemu_get_byte(QEMUFile *f) { - if (f->is_write) { - abort(); - } + int result; - if (f->buf_index >= f->buf_size) { - qemu_fill_buffer(f); - if (f->buf_index >= f->buf_size) { - return 0; - } + result = qemu_peek_byte(f); + + if (f->buf_index < f->buf_size) { + f->buf_index++; } - return f->buf[f->buf_index++]; + return result; } int64_t qemu_ftell(QEMUFile *f)