From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36520) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZEali-0008HC-5x for qemu-devel@nongnu.org; Mon, 13 Jul 2015 06:15:27 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZEalg-0003eL-Qb for qemu-devel@nongnu.org; Mon, 13 Jul 2015 06:15:26 -0400 Received: from mail-wg0-x22a.google.com ([2a00:1450:400c:c00::22a]:35632) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZEalg-0003eC-Im for qemu-devel@nongnu.org; Mon, 13 Jul 2015 06:15:24 -0400 Received: by wgjx7 with SMTP id x7so291944299wgj.2 for ; Mon, 13 Jul 2015 03:15:24 -0700 (PDT) Sender: Paolo Bonzini References: <1436775182-67309-1-git-send-email-pyssling@ludd.ltu.se> From: Paolo Bonzini Message-ID: <55A38FBA.50505@redhat.com> Date: Mon, 13 Jul 2015 12:15:22 +0200 MIME-Version: 1.0 In-Reply-To: <1436775182-67309-1-git-send-email-pyssling@ludd.ltu.se> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 8bit Subject: Re: [Qemu-devel] [PATCH] qemu-char: Fix missed data on unix socket List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: pyssling@ludd.ltu.se, qemu-devel@nongnu.org On 13/07/2015 10:13, pyssling@ludd.ltu.se wrote: > Commit 812c1057 introduced HUP detection on unix and tcp sockets prior > to a read in tcp_chr_read. This unfortunately broke CloudStack 4.2 > which relied on the old behaviour where data on a socket was readable > even if a HUP was present. > > On Linux a working solution seems to be to simply check the HUP after > reading available data, while keeping the original behaviour for windows. > > There is then a divergence in behaviour for the two platforms, but this > seems better than breaking a whole software stack. There is no need to do something special on Windows, I think. You can unconditionally check G_IO_HUP after reading. One nit: > - if (size == 0) { > + if (size == 0 || (size < 0 && cond & G_IO_HUP)) { Please put (cond & G_IO_HUP) within parentheses. Please