From da7d998bbb80f141ed5743418a4dfa5c1409e75f Mon Sep 17 00:00:00 2001 From: Amit Shah Date: Mon, 25 Apr 2011 15:18:22 +0530 Subject: [PATCH] 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 Signed-off-by: Amit Shah --- qemu-char.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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; }