From: Jason A. Donenfeld Date: Sun, 8 Oct 2017 14:24:37 +0000 (+0200) Subject: wg: try again if dump is interrupted X-Git-Tag: v1.0.20191226~209 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8774fccff32c8f5ed5527fa4e349ee534d34174c;p=thirdparty%2Fwireguard-tools.git wg: try again if dump is interrupted Signed-off-by: Jason A. Donenfeld --- diff --git a/src/ipc.c b/src/ipc.c index 5625526..a460d28 100644 --- a/src/ipc.c +++ b/src/ipc.c @@ -855,11 +855,12 @@ static int kernel_get_device(struct wgdevice **dev, const char *interface) struct mnlg_socket *nlg; struct get_device_ctx ctx = { 0 }; +try_again: *dev = ctx.device = calloc(1, sizeof(struct wgdevice)); if (!*dev) return -errno; - nlg= mnlg_socket_open(WG_GENL_NAME, WG_GENL_VERSION); + nlg = mnlg_socket_open(WG_GENL_NAME, WG_GENL_VERSION); if (!nlg) { free_wgdevice(*dev); *dev = NULL; @@ -884,6 +885,8 @@ out: mnlg_socket_close(nlg); if (ret) { free_wgdevice(*dev); + if (ret == -EINTR) + goto try_again; *dev = NULL; } errno = -ret;