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>
#include "kvm/8250-serial.h"
+#include "kvm/read-write.h"
#include "kvm/ioport.h"
#include "kvm/util.h"
#include "kvm/kvm.h"
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;