qemu-char: Fix missed data on unix socket
commit4bf1cb03fbc43b0055af60d4ff093d6894aa4338
authorNils Carlson <pyssling@ludd.ltu.se>
Sun, 19 Jul 2015 20:39:56 +0000 (19 20:39 +0000)
committerPaolo Bonzini <pbonzini@redhat.com>
Thu, 23 Jul 2015 05:37:38 +0000 (23 07:37 +0200)
tree24f959f08e98449a3557689be37490413f234133
parent9172f428afc1461b1d9b33ebca3a679b9adf7c3a
qemu-char: Fix missed data on unix socket

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.

A working solution is to properly check the return values from recv,
handling a closed socket once there is no more data to read.

Also enable polling for G_IO_NVAL to ensure the callback is called
for all possible events as these should now be possible to handle
with the improved error detection.

Signed-off-by: Nils Carlson <pyssling@ludd.ltu.se>
Message-Id: <1437338396-22336-1-git-send-email-pyssling@ludd.ltu.se>
[Do not handle EINTR; use socket_error(). - Paolo]
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
qemu-char.c