]> Git Repo - qemu.git/commitdiff
qemu-char: retry g_poll on EINTR
authorPaolo Bonzini <[email protected]>
Tue, 1 Dec 2015 10:27:00 +0000 (11:27 +0100)
committerPaolo Bonzini <[email protected]>
Wed, 2 Dec 2015 11:01:43 +0000 (12:01 +0100)
This is a case where pty_chr_update_read_handler_locked's lack
of error checking can produce incorrect values.  We are not using
SIGUSR1 anymore, so this is quite theoretical, but easy to fix.

Reported-by: Markus Armbruster <[email protected]>
Reviewed-by: Markus Armbruster <[email protected]>
Signed-off-by: Paolo Bonzini <[email protected]>
qemu-char.c

index 5448b0f30b74d35f4b653d57cf15827735084c11..2969c44e84464a019ad515de53e86529dbdc0ad0 100644 (file)
@@ -1241,11 +1241,16 @@ static void pty_chr_update_read_handler_locked(CharDriverState *chr)
 {
     PtyCharDriver *s = chr->opaque;
     GPollFD pfd;
+    int rc;
 
     pfd.fd = g_io_channel_unix_get_fd(s->fd);
     pfd.events = G_IO_OUT;
     pfd.revents = 0;
-    g_poll(&pfd, 1, 0);
+    do {
+        rc = g_poll(&pfd, 1, 0);
+    } while (rc == -1 && errno == EINTR);
+    assert(rc >= 0);
+
     if (pfd.revents & G_IO_HUP) {
         pty_chr_state(chr, 0);
     } else {
This page took 0.02427 seconds and 4 git commands to generate.