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.
> We reset errno before reading and writing to
> ensure the correctness of errno's judgment
> 
> Signed-off-by: xinhua.Cao <caoxin...@huawei.com>
> ---
>  chardev/char-fe.c | 1 +
>  chardev/char.c    | 2 ++
>  2 files changed, 3 insertions(+)

The C11x standard "7.4 Errors <errno.h>" says that errno "is never set
to zero by any library function".  Please follow the errno usage
convention described in the C standard.

Instead of making functions called by tcp_chr_write() clear errno,
please fix tcp_chr_write() so that errno is only accessed when ret < 0.

Thanks,
Stefan

Attachment: signature.asc
Description: PGP signature

Reply via email to