diff options
author | Amit Shah <amit.shah@redhat.com> | 2011-02-10 12:55:20 +0530 |
---|---|---|
committer | Amit Shah <amit.shah@redhat.com> | 2011-03-21 16:57:13 +0530 |
commit | 2d6c1ef40f3678ab47a4d14fb5dadaa486bfcda6 (patch) | |
tree | c23a1a315307a23e0e97704a06226ed8288e5729 /qemu-char.c | |
parent | f9a90f189c780e066039f2de3906c73c48071bb7 (diff) |
char: Prevent multiple devices opening same chardev
Prevent:
-chardev socket,path=/tmp/foo,server,nowait,id=c0 \
-device virtserialport,chardev=c0,id=vs0 \
-device virtserialport,chardev=c0,id=vs1
Reported-by: Mike Cao <bcao@redhat.com>
Signed-off-by: Amit Shah <amit.shah@redhat.com>
Diffstat (limited to 'qemu-char.c')
-rw-r--r-- | qemu-char.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/qemu-char.c b/qemu-char.c index cad35d7717..c4557c30d0 100644 --- a/qemu-char.c +++ b/qemu-char.c @@ -197,6 +197,10 @@ void qemu_chr_add_handlers(CharDriverState *s, IOEventHandler *fd_event, void *opaque) { + if (!opaque) { + /* chr driver being released. */ + s->assigned = 0; + } s->chr_can_read = fd_can_read; s->chr_read = fd_read; s->chr_event = fd_event; |