From patchwork Mon Feb 4 12:50:48 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amit Shah X-Patchwork-Id: 218042 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id BFFDF2C02B5 for ; Tue, 5 Feb 2013 06:19:56 +1100 (EST) Received: from localhost ([::1]:33720 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U2LWv-0007WT-S4 for incoming@patchwork.ozlabs.org; Mon, 04 Feb 2013 07:52:13 -0500 Received: from eggs.gnu.org ([208.118.235.92]:50110) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U2LWB-0005vn-S1 for qemu-devel@nongnu.org; Mon, 04 Feb 2013 07:51:28 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1U2LWA-0003KO-K8 for qemu-devel@nongnu.org; Mon, 04 Feb 2013 07:51:27 -0500 Received: from mx1.redhat.com ([209.132.183.28]:8267) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U2LWA-0003KD-Co for qemu-devel@nongnu.org; Mon, 04 Feb 2013 07:51:26 -0500 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r14CpOHJ021644 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Mon, 4 Feb 2013 07:51:25 -0500 Received: from localhost ([10.3.113.7]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id r14CpLVU026658; Mon, 4 Feb 2013 07:51:22 -0500 From: Amit Shah To: Anthony Liguori Date: Mon, 4 Feb 2013 18:20:48 +0530 Message-Id: In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.67 on 10.5.11.12 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: Amit Shah , qemu list Subject: [Qemu-devel] [PATCH 2/4] char: fix return value of can_read functions on no input X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org When the can_read functions report the frontend isn't ready to accept data yet, return 'FALSE' instead of 'TRUE'. Signed-off-by: Amit Shah --- qemu-char.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/qemu-char.c b/qemu-char.c index 5731d02..7fa9372 100644 --- a/qemu-char.c +++ b/qemu-char.c @@ -1067,7 +1067,7 @@ static gboolean pty_chr_read(GIOChannel *chan, GIOCondition cond, void *opaque) if (len > s->read_bytes) len = s->read_bytes; if (len == 0) - return TRUE; + return FALSE; status = g_io_channel_read_chars(s->fd, (gchar *)buf, len, &size, NULL); if (status != G_IO_STATUS_NORMAL) { pty_chr_state(chr, 0); @@ -2237,7 +2237,7 @@ static gboolean udp_chr_read(GIOChannel *chan, GIOCondition cond, void *opaque) GIOStatus status; if (s->max_size == 0) - return TRUE; + return FALSE; status = g_io_channel_read_chars(s->chan, (gchar *)s->buf, sizeof(s->buf), &bytes_read, NULL); s->bufcnt = bytes_read; @@ -2492,7 +2492,7 @@ static gboolean tcp_chr_read(GIOChannel *chan, GIOCondition cond, void *opaque) int len, size; if (!s->connected || s->max_size <= 0) { - return TRUE; + return FALSE; } len = sizeof(buf); if (len > s->max_size)