Commit 8eb47d29 authored by Sasha Levin's avatar Sasha Levin Committed by Will Deacon
Browse files

kvm tools: Fix input hang when compiling without optimization



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: default avatarSasha Levin <levinsasha928@gmail.com>
Signed-off-by: default avatarPekka Enberg <penberg@kernel.org>
parent b4068fdf
#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;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment