]> git.ipfire.org Git - thirdparty/wireguard-tools.git/commitdiff
netlink: make sure to clear return value when trying again
authorJason A. Donenfeld <Jason@zx2c4.com>
Sat, 11 Jan 2020 17:16:13 +0000 (12:16 -0500)
committerJason A. Donenfeld <Jason@zx2c4.com>
Sat, 11 Jan 2020 17:16:50 +0000 (12:16 -0500)
Otherwise this runs in an infinite loop if at some point a dump was
interrupted.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
src/ipc.c

index 11106702480522a2bf8807cf0397e814dc0609e3..8b74b5c0e8b923f19a7cc2d59e941a6f16e4c594 100644 (file)
--- a/src/ipc.c
+++ b/src/ipc.c
@@ -881,11 +881,12 @@ static void coalesce_peers(struct wgdevice *device)
 
 static int kernel_get_device(struct wgdevice **device, const char *iface)
 {
-       int ret = 0;
+       int ret;
        struct nlmsghdr *nlh;
        struct mnlg_socket *nlg;
 
 try_again:
+       ret = 0;
        *device = calloc(1, sizeof(**device));
        if (!*device)
                return -errno;