aboutsummaryrefslogtreecommitdiff
path: root/qemu-char.c
diff options
context:
space:
mode:
authorAmit Shah <amit.shah@redhat.com>2011-04-25 15:18:22 +0530
committerAmit Shah <amit.shah@redhat.com>2011-04-28 11:11:04 +0530
commitda7d998bbb80f141ed5743418a4dfa5c1409e75f (patch)
tree9462a05191b4029335eb8ba3afec538a0ac299ba /qemu-char.c
parentd5b27167e17e0d9393d6364703cc68e7f018023c (diff)
char: Detect chardev release by NULL handlers as well as NULL opaque
Juan says he prefers these extra checks to ensure a user of a chardev is releasing it. Requested-by: Juan Quintela <quintela@redhat.com> Signed-off-by: Amit Shah <amit.shah@redhat.com>
Diffstat (limited to 'qemu-char.c')
-rw-r--r--qemu-char.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/qemu-char.c b/qemu-char.c
index eaf6571ac8..5e04a20b8c 100644
--- a/qemu-char.c
+++ b/qemu-char.c
@@ -197,7 +197,7 @@ void qemu_chr_add_handlers(CharDriverState *s,
IOEventHandler *fd_event,
void *opaque)
{
- if (!opaque) {
+ if (!opaque && !fd_can_read && !fd_read && !fd_event) {
/* chr driver being released. */
++s->avail_connections;
}