From: Amit Shah Date: Mon, 25 Apr 2011 09:48:22 +0000 (+0530) Subject: char: Detect chardev release by NULL handlers as well as NULL opaque X-Git-Tag: v0.15.0-rc0~330^2~1 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=da7d998bbb80f141ed5743418a4dfa5c1409e75f;p=thirdparty%2Fqemu.git 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 --- diff --git a/qemu-char.c b/qemu-char.c index eaf6571ac8a..5e04a20b8c4 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; }