Commit 519945dfbe270059cf012863b97343c752f634cf
1 parent
707b3ee0
Avoid (repeatedly) trying to read stdin after it has closed.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@2156 c046a42c-6fe2-441c-8c8c-71466251a162
Showing
1 changed file
with
5 additions
and
0 deletions
vl.c
@@ -1417,6 +1417,11 @@ static void stdio_read(void *opaque) | @@ -1417,6 +1417,11 @@ static void stdio_read(void *opaque) | ||
1417 | uint8_t buf[1]; | 1417 | uint8_t buf[1]; |
1418 | 1418 | ||
1419 | size = read(0, buf, 1); | 1419 | size = read(0, buf, 1); |
1420 | + if (size == 0) { | ||
1421 | + /* stdin has been closed. Remove it from the active list. */ | ||
1422 | + qemu_set_fd_handler2(0, NULL, NULL, NULL, NULL); | ||
1423 | + return; | ||
1424 | + } | ||
1420 | if (size > 0) | 1425 | if (size > 0) |
1421 | stdio_received_byte(buf[0]); | 1426 | stdio_received_byte(buf[0]); |
1422 | } | 1427 | } |