Commit 188157fe87f24fc4200deba17bb258ec5ddb6ca1
1 parent
58126404
Remove FD on close.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@2207 c046a42c-6fe2-441c-8c8c-71466251a162
Showing
1 changed file
with
5 additions
and
0 deletions
vl.c
... | ... | @@ -1228,6 +1228,11 @@ static void fd_chr_read(void *opaque) |
1228 | 1228 | if (len == 0) |
1229 | 1229 | return; |
1230 | 1230 | size = read(s->fd_in, buf, len); |
1231 | + if (size == 0) { | |
1232 | + /* FD has been closed. Remove it from the active list. */ | |
1233 | + qemu_set_fd_handler2(s->fd_in, NULL, NULL, NULL, NULL); | |
1234 | + return; | |
1235 | + } | |
1231 | 1236 | if (size > 0) { |
1232 | 1237 | s->fd_read(s->fd_opaque, buf, size); |
1233 | 1238 | } | ... | ... |