From 506a59b62e442f31857d954bca12f76202d0640c Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Sat, 2 Mar 2019 15:38:01 +0100 Subject: [PATCH] libnm: fix return value for nm_wireguard_peer_append_allowed_ip() According to documentation, this returns a boolean indicating whether the value is valid. Previously, it was indicating whether the instance was modified. Together with the @accept_invalid argument, both behaviors make some sense. Change it, because that is also how the other setters behave. (cherry picked from commit f3ac8c6fe83a18c99fbbd32100924402a360e16e) --- libnm-core/nm-setting-wireguard.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/libnm-core/nm-setting-wireguard.c b/libnm-core/nm-setting-wireguard.c index 6785bf4a4..7629bfef4 100644 --- a/libnm-core/nm-setting-wireguard.c +++ b/libnm-core/nm-setting-wireguard.c @@ -647,6 +647,7 @@ _peer_append_allowed_ip (NMWireGuardPeer *self, int prefix; NMIPAddr addrbin; char *str; + gboolean is_valid = TRUE; nm_assert (NM_IS_WIREGUARD_PEER (self, FALSE)); nm_assert (allowed_ip); @@ -662,6 +663,7 @@ _peer_append_allowed_ip (NMWireGuardPeer *self, return FALSE; /* mark the entry as invalid by having a "X" prefix. */ str = g_strconcat (ALLOWED_IP_INVALID_X_STR, allowed_ip, NULL); + is_valid = FALSE; } else { char addrstr[NM_UTILS_INET_ADDRSTRLEN]; @@ -679,7 +681,7 @@ _peer_append_allowed_ip (NMWireGuardPeer *self, self->allowed_ips = g_ptr_array_new_with_free_func (g_free); g_ptr_array_add (self->allowed_ips, str); - return TRUE; + return is_valid; } /**