Commit 2c8a5942 authored by Kevin Wolf's avatar Kevin Wolf Committed by Anthony Liguori
Browse files

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.

Signed-off-by: default avatarKevin Wolf <kwolf@redhat.com>
Signed-off-by: default avatarAnthony Liguori <aliguori@us.ibm.com>
parent f628926b
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -153,7 +153,7 @@ 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,
int qemu_chr_fe_add_watch(CharDriverState *s, GIOCondition cond,
                          GIOFunc func, void *user_data);

/**
+2 −2
Original line number Diff line number Diff line
@@ -3397,7 +3397,7 @@ void qemu_chr_fe_close(struct CharDriverState *chr)
    }
}

guint qemu_chr_fe_add_watch(CharDriverState *s, GIOCondition cond,
int qemu_chr_fe_add_watch(CharDriverState *s, GIOCondition cond,
                          GIOFunc func, void *user_data)
{
    GSource *src;