When kwboot is attached to a terminal which disappears such as one
connected via an unplugged USB cable, read() returns 0, making kwboot
loop until a key is pressed in the terminal. The only case where read()
may return 0 here is when the terminal is closed anyway, so let's
properly handle this one and report is similar to other errors.
Signed-off-by: Willy Tarreau <w@1wt.eu>
Signed-off-by: Stefan Roese <sr@denx.de>
}
n = read(fd, buf, len);
- if (n < 0)
+ if (n <= 0)
goto out;
buf = (char *)buf + n;
char _buf[128], *buf = _buf;
nin = read(in, buf, sizeof(buf));
- if (nin < 0)
+ if (nin <= 0)
return -1;
if (quit) {