From: Antonio Quartulli
Date: Wed, 13 Jul 2022 12:14:16 +0000 (+0200)
Subject: networking_sitnl: always return negative error code in case of failure
X-Git-Tag: v2.6_beta1~168
X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=dab9343a0530ee2468304823181372393d365675;p=thirdparty%2Fopenvpn.git
networking_sitnl: always return negative error code in case of failure
The API is designed to always return a negative error code in case of
failure, therefore we should return '-errno' when ifindex has failed.
Signed-off-by: Antonio Quartulli
Acked-by: Gert Doering
Message-Id: <20220713121416.1912-1-a@unstable.cc>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg24686.html
Signed-off-by: Gert Doering
---
diff --git a/src/openvpn/networking_sitnl.c b/src/openvpn/networking_sitnl.c
index 0944ad0a9..46db23612 100644
--- a/src/openvpn/networking_sitnl.c
+++ b/src/openvpn/networking_sitnl.c
@@ -1374,7 +1374,7 @@ net_iface_del(openvpn_net_ctx_t *ctx, const char *iface)
if (!ifindex)
{
- return errno;
+ return -errno;
}
req.n.nlmsg_len = NLMSG_LENGTH(sizeof(req.i));