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>
This commit is contained in:
parent
d5b27167e1
commit
da7d998bbb
@ -197,7 +197,7 @@ void qemu_chr_add_handlers(CharDriverState *s,
|
|||||||
IOEventHandler *fd_event,
|
IOEventHandler *fd_event,
|
||||||
void *opaque)
|
void *opaque)
|
||||||
{
|
{
|
||||||
if (!opaque) {
|
if (!opaque && !fd_can_read && !fd_read && !fd_event) {
|
||||||
/* chr driver being released. */
|
/* chr driver being released. */
|
||||||
++s->avail_connections;
|
++s->avail_connections;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user