]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
kvm tools: Fix input hang when compiling without optimization
authorSasha Levin <levinsasha928@gmail.com>
Wed, 6 Apr 2011 18:47:27 +0000 (21:47 +0300)
committerPekka Enberg <penberg@kernel.org>
Wed, 6 Apr 2011 18:51:43 +0000 (21:51 +0300)
When compiling without optimizations (-O0) input would hang.
This was caused by poll() returning there was data to read but read()
failing.

Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
tools/kvm/8250-serial.c

index f0aa69e132c79d4892db16d1de4b6d7165d1a100..939e9f53a0ca8c84a50fc8a20947dfdebfba4498 100644 (file)
@@ -1,5 +1,6 @@
 #include "kvm/8250-serial.h"
 
+#include "kvm/read-write.h"
 #include "kvm/ioport.h"
 #include "kvm/util.h"
 #include "kvm/kvm.h"
@@ -55,9 +56,9 @@ static struct serial8250_device devices[] = {
 
 static int read_char(int fd)
 {
-       int c;
+       char c;
 
-       if (read(fd, &c, 1) < 0)
+       if (read_in_full(fd, &c, 1) == 0)
                return -1;
 
        return c;