diff mbox

[2/4] qemu-file: Use qemu_file_is_writable() on stdio_fclose()

Message ID 1412195677-24529-3-git-send-email-ehabkost@redhat.com
State New
Headers show

Commit Message

Eduardo Habkost Oct. 1, 2014, 8:34 p.m. UTC
Use the existing function which checks if writev_buffer() or
put_buffer() are set, instead of duplicating it.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
 qemu-file.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox

Patch

diff --git a/qemu-file.c b/qemu-file.c
index 6c8a6c9..482bda6 100644
--- a/qemu-file.c
+++ b/qemu-file.c
@@ -152,7 +152,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;