]> Git Repo - qemu.git/commitdiff
chardev: fix handling of EAGAIN for TCP chardev
authorDaniel P. Berrangé <[email protected]>
Thu, 22 Feb 2018 12:13:51 +0000 (12:13 +0000)
committerPaolo Bonzini <[email protected]>
Mon, 12 Mar 2018 15:12:46 +0000 (16:12 +0100)
When this commit was applied

  commit 9894dc0cdcc397ee5b26370bc53da6d360a363c2
  Author: Daniel P. Berrange <[email protected]>
  Date:   Tue Jan 19 11:14:29 2016 +0000

    char: convert from GIOChannel to QIOChannel

The tcp_chr_recv() function was changed to return QIO_CHANNEL_ERR_BLOCK
which corresonds to -2. As such the handling for EAGAIN was able to be
removed from tcp_chr_read(). Unfortunately in a later commit:

  commit b6572b4f97a7b126c7b24e165893ed9fe3d72e1f
  Author: Marc-André Lureau <[email protected]>
  Date:   Fri Mar 11 18:55:24 2016 +0100

    char: translate from QIOChannel error to errno

The tcp_chr_recv() function was changed back to return -1, with errno
set to EAGAIN, without also re-addding support for this to tcp_chr_read()

Reported-by: Aleksey Kuleshov <[email protected]>
Signed-off-by: Daniel P. Berrangé <[email protected]>
Message-Id: <20180222121351[email protected]>
Reviewed-by: Marc-André Lureau <[email protected]>
Signed-off-by: Paolo Bonzini <[email protected]>
chardev/char-socket.c

index a220803c012383c52b7c3f1ed3bad9b7b7ae9d92..541fcf487df5c745966ee9816396129188638c8f 100644 (file)
@@ -450,7 +450,7 @@ static gboolean tcp_chr_read(QIOChannel *chan, GIOCondition cond, void *opaque)
         len = s->max_size;
     }
     size = tcp_chr_recv(chr, (void *)buf, len);
-    if (size == 0 || size == -1) {
+    if (size == 0 || (size == -1 && errno != EAGAIN)) {
         /* connection closed */
         tcp_chr_disconnect(chr);
     } else if (size > 0) {
This page took 0.030068 seconds and 4 git commands to generate.