This is an automated email from the ASF dual-hosted git repository.

xiaoxiang pushed a commit to branch releases/12.12
in repository https://gitbox.apache.org/repos/asf/nuttx.git

commit e0d3af4b4133d6ee43be60bf7798200f08b85fba
Author: zhanghongyu <[email protected]>
AuthorDate: Thu Feb 13 22:33:18 2025 +0800

    icmp/icmp6: fix errno forgot to add a negative sign
    
    otherwise, errors cannot be returned correctly
    
    Signed-off-by: zhanghongyu <[email protected]>
---
 net/icmp/icmp_sockif.c     | 4 ++--
 net/icmpv6/icmpv6_sockif.c | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/net/icmp/icmp_sockif.c b/net/icmp/icmp_sockif.c
index e903a55c3a8..5aedef1b2c6 100644
--- a/net/icmp/icmp_sockif.c
+++ b/net/icmp/icmp_sockif.c
@@ -321,7 +321,7 @@ static int icmp_getsockopt_internal(FAR struct socket 
*psock, int option,
 
   if (psock->s_type != SOCK_RAW)
     {
-      return ENOPROTOOPT;
+      return -ENOPROTOOPT;
     }
 
   net_lock();
@@ -429,7 +429,7 @@ static int icmp_setsockopt_internal(FAR struct socket 
*psock, int option,
 
   if (psock->s_type != SOCK_RAW)
     {
-      return ENOPROTOOPT;
+      return -ENOPROTOOPT;
     }
 
   net_lock();
diff --git a/net/icmpv6/icmpv6_sockif.c b/net/icmpv6/icmpv6_sockif.c
index 057829dc66c..e38ee9eb9bd 100644
--- a/net/icmpv6/icmpv6_sockif.c
+++ b/net/icmpv6/icmpv6_sockif.c
@@ -319,7 +319,7 @@ static int icmpv6_getsockopt_internal(FAR struct socket 
*psock, int option,
 
   if (psock->s_type != SOCK_RAW)
     {
-      return ENOPROTOOPT;
+      return -ENOPROTOOPT;
     }
 
   net_lock();
@@ -427,7 +427,7 @@ static int icmpv6_setsockopt_internal(FAR struct socket 
*psock, int option,
 
   if (psock->s_type != SOCK_RAW)
     {
-      return ENOPROTOOPT;
+      return -ENOPROTOOPT;
     }
 
   net_lock();

Reply via email to