From: Eduardo Habkost Date: Wed, 1 Oct 2014 20:34:35 +0000 (-0300) Subject: qemu-file: Use qemu_file_is_writable() on stdio_fclose() X-Git-Tag: qemu-xen-4.6.0-rc1~133^2~3 X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=532bc727c34665370ab0ba94a9536fd3a6c2c5bc;p=qemu-upstream-4.6-testing.git 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 --- diff --git a/qemu-file.c b/qemu-file.c index c303b6137..9cb12239e 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;