Skip to contentSkip to conversation

char: Fix return type of qemu_chr_fe_add_watch()

PATCH Applied Kevin Wolf 2 participants 2 messages Mar 19, 2013

lore
Share & tools
lore

Kevin Wolf

author
#0 lore raw

PATCH 1/1 char: Fix return type of qemu_chr_fe_add_watch()

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.

---
 include/char/char.h | 4 ++--
 qemu-char.c         | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)
include/char/char.h +2 -2
index d6a0351..0326b2a 100644
@@ -153,8 +153,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:
qemu-char.c +2 -2
index e633797..4e011df 100644
@@ -3397,8 +3397,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;
Signature · 1 line
1.8.1.4