]> git.proxmox.com Git - qemu.git/commit
char: io_channel_send: don't lose written bytes
authorLaszlo Ersek <lersek@redhat.com>
Tue, 16 Jul 2013 18:19:40 +0000 (20:19 +0200)
committerAnthony Liguori <aliguori@us.ibm.com>
Thu, 18 Jul 2013 16:22:56 +0000 (11:22 -0500)
commitac8c26f633b01bb32cdf347f9dbd5a80c6712925
tree37a4d6becbd45b50864e15cdb72d2ab7eb597c8c
parent0d185e638861bd9b05b2abb43774a368cadabd38
char: io_channel_send: don't lose written bytes

The g_io_channel_write_chars() documentation states,

  bytes_written: The number of bytes written. This can be nonzero even if
                 the return value is not G_IO_STATUS_NORMAL. [...]

io_channel_send() could lose such bytes before.

Furthermore, the (status == G_IO_STATUS_EOF) condition used to evaluate to
constant false whenever it was reached. When that condition actually held,
it always led to -1 / EINVAL. This patch (almost) distinguishes
G_IO_STATUS_EOF only when no bytes have been written, and then treats it
as an error.

Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Amit Shah <amit.shah@redhat.com>
Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>
Message-id: 1373998781-29561-2-git-send-email-lersek@redhat.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
qemu-char.c