From e0d3af4b4133d6ee43be60bf7798200f08b85fba Mon Sep 17 00:00:00 2001 From: zhanghongyu Date: Thu, 13 Feb 2025 22:33:18 +0800 Subject: [PATCH] icmp/icmp6: fix errno forgot to add a negative sign otherwise, errors cannot be returned correctly Signed-off-by: zhanghongyu --- 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();