From e489a308c89af1cd676dabd79d85b83bf4d0f2e2 Mon Sep 17 00:00:00 2001 From: ligd Date: Tue, 29 Mar 2022 21:44:21 +0800 Subject: [PATCH] local_socket: remove error log when use nonblock mode Signed-off-by: ligd --- net/local/local_recvutils.c | 16 ++++++++++++---- net/local/local_sendpacket.c | 11 +++++++++-- 2 files changed, 21 insertions(+), 6 deletions(-) diff --git a/net/local/local_recvutils.c b/net/local/local_recvutils.c index cdead61309..ee67074d76 100644 --- a/net/local/local_recvutils.c +++ b/net/local/local_recvutils.c @@ -78,14 +78,22 @@ int local_fifo_read(FAR struct file *filep, FAR uint8_t *buf, nread = file_read(filep, buf, remaining); if (nread < 0) { - if (nread != -EINTR) + ret = (int)nread; + + if (nread == -EINTR) + { + ninfo("Ignoring signal\n"); + continue; + } + else if (nread == -EAGAIN) + { + goto errout; + } + else { - ret = (int)nread; nerr("ERROR: file_read() failed: %d\n", ret); goto errout; } - - ninfo("Ignoring signal\n"); } else if (nread == 0) { diff --git a/net/local/local_sendpacket.c b/net/local/local_sendpacket.c index a2840ece26..937c40a717 100644 --- a/net/local/local_sendpacket.c +++ b/net/local/local_sendpacket.c @@ -86,13 +86,20 @@ static int local_fifo_write(FAR struct file *filep, FAR const uint8_t *buf, ret = file_write(filep, buf + nwritten, len - nwritten); if (ret < 0) { - if (ret != -EINTR) + if (ret == -EINTR) + { + continue; + } + else if (ret == -EAGAIN) + { + break; + } + else { nerr("ERROR: file_write failed: %zd\n", ret); break; } - continue; } nwritten += ret;