summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2014-07-25 16:58:41 +0100
committerPeter Maydell <peter.maydell@linaro.org>2014-07-25 16:58:41 +0100
commitc60a57ff497667780132a3fcdc1500c83af5d5c0 (patch)
tree6bd143526680483005a576f92dc2555f0116a22a
parent7f0b2ff7248f7621b375f108e54eed5690769c47 (diff)
parent62c339c5272ce8fbe8ca52695cee8ff40da7872e (diff)
downloadqemu-c60a57ff497667780132a3fcdc1500c83af5d5c0.tar.gz
qemu-c60a57ff497667780132a3fcdc1500c83af5d5c0.tar.bz2
qemu-c60a57ff497667780132a3fcdc1500c83af5d5c0.zip
Merge remote-tracking branch 'remotes/bonzini/tags/for-upstream' into staging
Here is the serial fix for 2.1. # gpg: Signature made Fri 25 Jul 2014 13:36:23 BST using RSA key ID 9B4D86F2 # gpg: Good signature from "Paolo Bonzini <pbonzini@redhat.com>" # gpg: aka "Paolo Bonzini <bonzini@gnu.org>" * remotes/bonzini/tags/for-upstream: qemu-char: ignore flow control if a PTY's slave is not connected Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
-rw-r--r--qemu-char.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/qemu-char.c b/qemu-char.c
index 7acc03f161..956be49ecd 100644
--- a/qemu-char.c
+++ b/qemu-char.c
@@ -1168,6 +1168,9 @@ static int pty_chr_write(CharDriverState *chr, const uint8_t *buf, int len)
static GSource *pty_chr_add_watch(CharDriverState *chr, GIOCondition cond)
{
PtyCharDriver *s = chr->opaque;
+ if (!s->connected) {
+ return NULL;
+ }
return g_io_create_watch(s->fd, cond);
}
@@ -3664,6 +3667,10 @@ int qemu_chr_fe_add_watch(CharDriverState *s, GIOCondition cond,
}
src = s->chr_add_watch(s, cond);
+ if (!src) {
+ return -EINVAL;
+ }
+
g_source_set_callback(src, (GSourceFunc)func, user_data, NULL);
tag = g_source_attach(src, NULL);
g_source_unref(src);