From 46b7a5c2311e82888978c9f9541f4c23b27808cc Mon Sep 17 00:00:00 2001 Message-Id: <46b7a5c2311e82888978c9f9541f4c23b27808cc.1368111914.git.minovotn@redhat.com> In-Reply-To: <405603258af5154387bea676be1f904b6713f6ae.1368111913.git.minovotn@redhat.com> References: <405603258af5154387bea676be1f904b6713f6ae.1368111913.git.minovotn@redhat.com> From: Amit Shah Date: Wed, 24 Apr 2013 08:18:20 +0200 Subject: [PATCH 46/65] char: Fix return type of qemu_chr_fe_add_watch() RH-Author: Amit Shah Message-id: <39d0c5aad83f9b9e5e334eebf5ef562258467cf4.1366724981.git.amit.shah@redhat.com> Patchwork-id: 50824 O-Subject: [RHEL6.5 qemu-kvm PATCH 46/65] char: Fix return type of qemu_chr_fe_add_watch() Bugzilla: 909059 RH-Acked-by: Hans de Goede RH-Acked-by: Gerd Hoffmann RH-Acked-by: Paolo Bonzini From: Kevin Wolf qemu_chr_fe_add_watch() can return negative errors, therefore it must not have an unsigned return type. For consistency with other qemu_chr_fe_* functions, this uses a standard C int instead of glib types. In situations where qemu_chr_fe_add_watch() is falsely assumed to have succeeded, the serial ports would go into a state where it never becomes ready for transmitting more data; this is fixed by this patch. Signed-off-by: Kevin Wolf Signed-off-by: Anthony Liguori (cherry picked from commit 2c8a59422c06fe1e37c85502d92ccdfb5e2ac987) Signed-off-by: Amit Shah --- qemu-char.c | 4 ++-- qemu-char.h | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) Signed-off-by: Michal Novotny --- qemu-char.c | 4 ++-- qemu-char.h | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/qemu-char.c b/qemu-char.c index 142d285..3ef2ae4 100644 --- a/qemu-char.c +++ b/qemu-char.c @@ -2819,8 +2819,8 @@ void qemu_chr_fe_close(struct CharDriverState *chr) } } -guint qemu_chr_fe_add_watch(CharDriverState *s, GIOCondition cond, - GIOFunc func, void *user_data) +int qemu_chr_fe_add_watch(CharDriverState *s, GIOCondition cond, + GIOFunc func, void *user_data) { GSource *src; guint tag; diff --git a/qemu-char.h b/qemu-char.h index 5bbe0cc..3a1b28f 100644 --- a/qemu-char.h +++ b/qemu-char.h @@ -150,8 +150,8 @@ void qemu_chr_fe_close(struct CharDriverState *chr); void qemu_chr_fe_printf(CharDriverState *s, const char *fmt, ...) GCC_FMT_ATTR(2, 3); -guint qemu_chr_fe_add_watch(CharDriverState *s, GIOCondition cond, - GIOFunc func, void *user_data); +int qemu_chr_fe_add_watch(CharDriverState *s, GIOCondition cond, + GIOFunc func, void *user_data); /** * @qemu_chr_fe_write: -- 1.7.11.7