From: Eduardo Habkost <ehabk...@redhat.com>

Use the existing function which checks if writev_buffer() or
put_buffer() are set, instead of duplicating it.

Signed-off-by: Eduardo Habkost <ehabk...@redhat.com>
Reviewed-by: Markus Armbruster <arm...@redhat.com>
Signed-off-by: Juan Quintela <quint...@redhat.com>
---
 qemu-file.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/qemu-file.c b/qemu-file.c
index c303b61..9cb1223 100644
--- a/qemu-file.c
+++ b/qemu-file.c
@@ -175,7 +175,7 @@ static int stdio_fclose(void *opaque)
     QEMUFileStdio *s = opaque;
     int ret = 0;

-    if (s->file->ops->put_buffer || s->file->ops->writev_buffer) {
+    if (qemu_file_is_writable(s->file)) {
         int fd = fileno(s->stdio_file);
         struct stat st;

-- 
2.1.0


Reply via email to