From: Simon Rozman via Openvpn-devel Date: Sun, 21 Mar 2021 14:46:25 +0000 (+0100) Subject: interactive.c: Resolve MSVC C4996 warning X-Git-Tag: v2.6_beta1~601 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=709c3810a1d67e2c4049e852529a0a0d1338c797;p=thirdparty%2Fopenvpn.git interactive.c: Resolve MSVC C4996 warning It's about using a standard recommended alias for the wcsdup(): > warning C4996: 'wcsdup': The POSIX name for this item is deprecated. > Instead, use the ISO C and C++ conformant name: _wcsdup. See online > help for details. And the documentation says: > The Microsoft-implemented POSIX function names strdup and wcsdup are > deprecated aliases for the _strdup and _wcsdup functions. By default, > they generate Compiler warning (level 3) C4996. The names are > deprecated because they don't follow the Standard C rules for > implementation-specific names. However, the functions are still > supported. > > We recommend you use _strdup and _wcsdup instead. Or, you can continue > to use these function names, and disable the warning. For more > information, see Turn off the warning and POSIX function names. Reference: https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/strdup-wcs dup Signed-off-by: Simon Rozman Acked-by: Arne Schwabe Message-Id: <20210321144627.1621-3-simon@rozman.si> URL: https://www.mail-archive.com/search?l=mid&q=20210321144627.1621-3-simon@rozman.si Signed-off-by: Gert Doering --- diff --git a/src/openvpnserv/interactive.c b/src/openvpnserv/interactive.c index 5d5cbfe60..b073a0d5a 100644 --- a/src/openvpnserv/interactive.c +++ b/src/openvpnserv/interactive.c @@ -899,7 +899,7 @@ ExecCommand(const WCHAR *argv0, const WCHAR *cmdline, DWORD timeout) si.cb = sizeof(si); /* CreateProcess needs a modifiable cmdline: make a copy */ - cmdline_dup = wcsdup(cmdline); + cmdline_dup = _wcsdup(cmdline); if (cmdline_dup && CreateProcessW(argv0, cmdline_dup, NULL, NULL, FALSE, proc_flags, NULL, NULL, &si, &pi) ) { @@ -1181,7 +1181,7 @@ SetDNSDomain(const wchar_t *if_name, const char *domain, undo_lists_t *lists) /* Add to undo list if domain is non-empty */ if (err == 0 && wdomain[0] && lists) { - wchar_t *tmp_name = wcsdup(if_name); + wchar_t *tmp_name = _wcsdup(if_name); if (!tmp_name || AddListItem(&(*lists)[undo_domain], tmp_name)) { free(tmp_name); @@ -1272,7 +1272,7 @@ HandleDNSConfigMessage(const dns_cfg_message_t *msg, undo_lists_t *lists) if (msg->addr_len > 0) { - wchar_t *tmp_name = wcsdup(wide_name); + wchar_t *tmp_name = _wcsdup(wide_name); if (!tmp_name || AddListItem(&(*lists)[undo_type], tmp_name)) { free(tmp_name);