From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:53890) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XZQc2-0006rY-3W for qemu-devel@nongnu.org; Wed, 01 Oct 2014 16:35:08 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XZQbw-0006S8-0F for qemu-devel@nongnu.org; Wed, 01 Oct 2014 16:35:02 -0400 Received: from mx1.redhat.com ([209.132.183.28]:28559) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XZQbv-0006S2-Pd for qemu-devel@nongnu.org; Wed, 01 Oct 2014 16:34:55 -0400 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s91KYtrd002707 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL) for ; Wed, 1 Oct 2014 16:34:55 -0400 From: Eduardo Habkost Date: Wed, 1 Oct 2014 17:34:35 -0300 Message-Id: <1412195677-24529-3-git-send-email-ehabkost@redhat.com> In-Reply-To: <1412195677-24529-1-git-send-email-ehabkost@redhat.com> References: <1412195677-24529-1-git-send-email-ehabkost@redhat.com> Subject: [Qemu-devel] [PATCH 2/4] qemu-file: Use qemu_file_is_writable() on stdio_fclose() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org, Juan Quintela Cc: Paolo Bonzini Use the existing function which checks if writev_buffer() or put_buffer() are set, instead of duplicating it. Signed-off-by: Eduardo Habkost --- qemu-file.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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; -- 1.9.3