From 532bc727c34665370ab0ba94a9536fd3a6c2c5bc Mon Sep 17 00:00:00 2001 From: Eduardo Habkost Date: Wed, 1 Oct 2014 17:34:35 -0300 Subject: [PATCH] qemu-file: Use qemu_file_is_writable() on stdio_fclose() Use the existing function which checks if writev_buffer() or put_buffer() are set, instead of duplicating it. Signed-off-by: Eduardo Habkost Reviewed-by: Markus Armbruster Signed-off-by: Juan Quintela --- qemu-file.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/qemu-file.c b/qemu-file.c index c303b61373..9cb12239e5 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;