From: David Woodhouse Date: Sat, 26 Feb 2022 17:34:26 +0000 (+0000) Subject: Fix Windows tun setup crash X-Git-Tag: v9.00~81 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=6a2ffbbcd1c4ef0b689cce3d17154f6d4c2e3bc0;p=users%2Fdwmw2%2Fopenconnect.git Fix Windows tun setup crash The intention was to use vpninfo->hostname, by passing it as a parameter to the create_ifname_w() function. But that function still just uses vpninfo->ifname unconditionally, ignoring the argument. And causing the crash in #370. Fix up some bogus formatting while we're at it. We don't do open braces on the same line as the function declaration. Fixes: 48bd28aadd ("Use hostname as Wintun ifname (if ifname not specified)") Signed-off-by: David Woodhouse --- diff --git a/tun-win32.c b/tun-win32.c index 208c44a0..f0ee4885 100644 --- a/tun-win32.c +++ b/tun-win32.c @@ -477,9 +477,12 @@ static intptr_t open_tun(struct openconnect_info *vpninfo, int adapter_type, cha return ret; } -static intptr_t create_ifname_w(struct openconnect_info *vpninfo, const char *ifname) { +static intptr_t create_ifname_w(struct openconnect_info *vpninfo, + const char *ifname) +{ struct oc_text_buf *ifname_buf = buf_alloc(); - buf_append_utf16le(ifname_buf, vpninfo->ifname); + + buf_append_utf16le(ifname_buf, ifname); if (buf_error(ifname_buf)) { vpn_progress(vpninfo, PRG_ERR, _("Could not construct interface name\n"));