From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44855) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XeJto-0006lz-TW for qemu-devel@nongnu.org; Wed, 15 Oct 2014 04:25:42 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XeJti-0002Cd-LF for qemu-devel@nongnu.org; Wed, 15 Oct 2014 04:25:36 -0400 Received: from mx1.redhat.com ([209.132.183.28]:58829) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XeJti-0002CK-4M for qemu-devel@nongnu.org; Wed, 15 Oct 2014 04:25:30 -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 s9F8PTDl012073 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL) for ; Wed, 15 Oct 2014 04:25:29 -0400 From: Juan Quintela Date: Wed, 15 Oct 2014 10:25:01 +0200 Message-Id: <1413361504-26396-8-git-send-email-quintela@redhat.com> In-Reply-To: <1413361504-26396-1-git-send-email-quintela@redhat.com> References: <1413361504-26396-1-git-send-email-quintela@redhat.com> Subject: [Qemu-devel] [PULL 07/10] 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 Cc: Eduardo Habkost From: Eduardo Habkost 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 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