Re: [Qemu-devel] [PATCH] qemu-char: reset errno before qemu char write or read action

2018-07-03 Thread xinhua . Cao
在 2018/7/2 16:46, Paolo Bonzini 写道: On 02/07/2018 02:49, xinhua.Cao wrote: In the tcp_chr_write function, we checked errno, but errno was not reset before a read or write operation. Therefore, this check of errno's actions is often incorrect after EAGAIN has occurred. We reset errno before re

[Qemu-devel] [PATCH] qemu-char: check errno together with ret < 0

2018-07-03 Thread xinhua . Cao
In the tcp_chr_write function, we checked errno, but errno was not reset before a read or write operation. Therefore, this check of errno's actions is often incorrect after EAGAIN has occurred. we need check errno together with ret < 0. Signed-off-by: xinhua.Cao --- chardev/char-socket.c | 7 +++

Re: [Qemu-devel] [PATCH] qemu-char: reset errno before qemu char write or read action

2018-07-03 Thread xinhua . Cao
在 2018/7/2 23:01, Stefan Hajnoczi 写道: On Mon, Jul 02, 2018 at 08:49:10AM +0800, xinhua.Cao wrote: In the tcp_chr_write function, we checked errno, but errno was not reset before a read or write operation. Therefore, this check of errno's actions is often incorrect after EAGAIN has occurred. W

[Qemu-devel] [PATCH] qemu-char: reset errno before qemu char write or read action

2018-07-01 Thread xinhua . Cao
In the tcp_chr_write function, we checked errno, but errno was not reset before a read or write operation. Therefore, this check of errno's actions is often incorrect after EAGAIN has occurred. We reset errno before reading and writing to ensure the correctness of errno's judgment Signed-off-by: x