From patchwork Fri Feb 18 01:41:49 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lev Stipakov X-Patchwork-Id: 2304 Return-Path: Delivered-To: patchwork@openvpn.net Delivered-To: patchwork@openvpn.net Received: from director9.mail.ord1d.rsapps.net ([172.27.255.52]) by backend41.mail.ord1d.rsapps.net with LMTP id GKCjA3SUD2IzRgAAqwncew (envelope-from ) for ; Fri, 18 Feb 2022 07:43:32 -0500 Received: from proxy18.mail.iad3a.rsapps.net ([172.27.255.52]) by director9.mail.ord1d.rsapps.net with LMTP id qP/fDnSUD2JeDgAAalYnBA (envelope-from ) for ; Fri, 18 Feb 2022 07:43:32 -0500 Received: from smtp6.gate.iad3a ([172.27.255.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) by proxy18.mail.iad3a.rsapps.net with LMTPS id uMEFCHSUD2LUfwAAon3hFg (envelope-from ) for ; Fri, 18 Feb 2022 07:43:32 -0500 X-Spam-Threshold: 95 X-Spam-Score: 0 X-Spam-Flag: NO X-Virus-Scanned: OK X-Orig-To: openvpnslackdevel@openvpn.net X-Originating-Ip: [216.105.38.7] Authentication-Results: smtp6.gate.iad3a.rsapps.net; iprev=pass policy.iprev="216.105.38.7"; spf=pass smtp.mailfrom="openvpn-devel-bounces@lists.sourceforge.net" smtp.helo="lists.sourceforge.net"; dkim=fail (signature verification failed) header.d=sourceforge.net; dkim=fail (signature verification failed) header.d=sf.net; dkim=fail (signature verification failed) header.d=gmail.com; dmarc=fail (p=none; dis=none) header.from=gmail.com X-Suspicious-Flag: YES X-Classification-ID: 60803fda-90b8-11ec-a297-5254002f0085-1-1 Received: from [216.105.38.7] ([216.105.38.7:59116] helo=lists.sourceforge.net) by smtp6.gate.iad3a.rsapps.net (envelope-from ) (ecelerity 4.2.38.62370 r(:)) with ESMTPS (cipher=DHE-RSA-AES256-GCM-SHA384) id 8E/32-07529-3749F026; Fri, 18 Feb 2022 07:43:31 -0500 Received: from [127.0.0.1] (helo=sfs-ml-1.v29.lw.sourceforge.com) by sfs-ml-1.v29.lw.sourceforge.com with esmtp (Exim 4.94.2) (envelope-from ) id 1nL2au-0002HT-Dw; Fri, 18 Feb 2022 12:42:39 +0000 Received: from [172.30.20.202] (helo=mx.sourceforge.net) by sfs-ml-1.v29.lw.sourceforge.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1nL2at-0002HG-Ck for openvpn-devel@lists.sourceforge.net; Fri, 18 Feb 2022 12:42:37 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sourceforge.net; s=x; h=Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To: MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=hnskYEUtL6WJGm0TVLZDe9LwMnlOUb3K9/Icp3465L8=; b=Ty6akGK8vNaC6OzIoYfAClqsSL U/Wi7Y5RwtWQbuBLo1IKoNZovDdVdPwW1anaBaybw5X76SYDkUCeGmGMGMW9Z+7aBocKtPmxx6gPX gPyq2gOKGauEL6ISwBkvRoCfblBFDFICNjrQYIkSZpKJscLbLWCEcKd72yNkyvLQmGmw=; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sf.net; s=x ; h=Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To:MIME-Version: Content-Type:Content-Transfer-Encoding:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=hnskYEUtL6WJGm0TVLZDe9LwMnlOUb3K9/Icp3465L8=; b=IBFVOPOxSVtS4WzeOPrUNIiC+o LKnQzIdklQUnLm/9Ea/SS9UKyqk0VRC4HkI3/RnzFVyR9xDCuCiXGkrPHqhDXsbJxjRwYhC5rJ1li uMSPxGO3zlzfi91D4v7vmHWL0tJto/AtZsJxdIc5o+BT+NysLtyvsO2DGBAH7Gak5g0o=; Received: from mail-wm1-f51.google.com ([209.85.128.51]) by sfi-mx-1.v28.lw.sourceforge.com with esmtps (TLS1.2:ECDHE-RSA-AES128-GCM-SHA256:128) (Exim 4.94.2) id 1nL2ao-0064b7-7O for openvpn-devel@lists.sourceforge.net; Fri, 18 Feb 2022 12:42:37 +0000 Received: by mail-wm1-f51.google.com with SMTP id w13so4675203wmi.2 for ; Fri, 18 Feb 2022 04:42:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id; bh=hnskYEUtL6WJGm0TVLZDe9LwMnlOUb3K9/Icp3465L8=; b=eUFqygmOZArEIgrFEX4muvPC5JTmgb9+qIgbrCqvB0Mw0vRJfZGwrwknJ5mOZ8/7m8 RP7iK1vehF4pqZKhE+SZ+z5ORZWsJvfsvqp+H+fDbuiMh3OVHyvRztwoj1026Uqhmohy 7y9oIeo9VIBauVCY/hm6dg6OWdnRRBNE594sR9DXsOEibqw/8QjGP07OknSHKxSnGysF /BNEoUJtmX/gW4GfGbjbXW+AV9rBPVU44eZEnQQwPpXvQ9MsoFgkG2YYuLjdAkFsSpfZ 7sZxyH8LTW2jMoLcwcrxRC68BBI+fEbRwhTSRp2RD6qd66Xl1gICyqUW3YlVWr6T46E2 iYdQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=hnskYEUtL6WJGm0TVLZDe9LwMnlOUb3K9/Icp3465L8=; b=JmAv/RRVpZRPorjBpQ46maYUW2tIO8a/9hmNIUj+AIUQ6q7MKnTbfY0orZUSKCNEkf XVkM/97WVdZ3EGIPJE7MH2+GtFesLm0NYN6loEeSsczg9tlIQvORV2nXoEL7aRMhjQjq uCZhrQbRaE3niSgNQ1DAZRpMWmwXPlNb0N7H7hpP7AT7vIPnXxQt1JhguerSkKls2zOU C5lFoEe1h9w4xHp4N8xcGwWa/Q0j60LGWqURNYhsoUGrReHSFNFf41WoKSwPl1lBzmwK 0jz2gBP4uHoOAFtysZa43jfXV/1SfhdbLj9roit15g25ktdOLlYeufrtUpk1dcUsyNcZ aYAQ== X-Gm-Message-State: AOAM532JizwNbAjzLOTvSzDZnYAB+kugmJfM/5OHYSuxC9FSYFrLc2AB a6ZhenERh0DuLVka0mu8zA8xpYT+9qOvWw== X-Google-Smtp-Source: ABdhPJyOGP/XiEqnuOHnNiywj1lb0GmliWblsZlFZR6Fhq3p3P0RCFU3/k3rJ3UtCKgGqFtur5H2XA== X-Received: by 2002:a05:600c:2285:b0:37c:3074:43d3 with SMTP id 5-20020a05600c228500b0037c307443d3mr7215672wmf.195.1645188147418; Fri, 18 Feb 2022 04:42:27 -0800 (PST) Received: from LAPTOP-4L3N7KFS.localdomain (nat4.panoulu.net. [185.38.2.4]) by smtp.gmail.com with ESMTPSA id r13sm29409081wro.89.2022.02.18.04.42.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 18 Feb 2022 04:42:27 -0800 (PST) From: Lev Stipakov To: openvpn-devel@lists.sourceforge.net Date: Fri, 18 Feb 2022 14:41:49 +0200 Message-Id: <20220218124149.149-1-lstipakov@gmail.com> X-Mailer: git-send-email 2.17.1 X-Spam-Report: Spam detection software, running on the system "util-spamd-2.v13.lw.sourceforge.com", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: From: Lev Stipakov On Windows we use GetLastError() to get error code. To get error description, we must use FormatMessage() and not strerror(). Replace strerror() with openvpn_strerror() macro, which is resolved to strerror_win32() (which calls FormatMessage) on Windows and to strerror() on other platforms. Content analysis details: (-0.2 points, 6.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider [lstipakov[at]gmail.com] 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.0 RCVD_IN_MSPIKE_H2 RBL: Average reputation (+2) [209.85.128.51 listed in wl.mailspike.net] -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [209.85.128.51 listed in list.dnswl.org] -0.0 T_SCC_BODY_TEXT_LINE No description available. X-Headers-End: 1nL2ao-0064b7-7O Subject: [Openvpn-devel] [PATCH master+release/2.5] error.c: use correct API to get error description on Windows X-BeenThere: openvpn-devel@lists.sourceforge.net X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Lev Stipakov MIME-Version: 1.0 Errors-To: openvpn-devel-bounces@lists.sourceforge.net X-getmail-retrieved-from-mailbox: Inbox From: Lev Stipakov On Windows we use GetLastError() to get error code. To get error description, we must use FormatMessage() and not strerror(). Replace strerror() with openvpn_strerror() macro, which is resolved to strerror_win32() (which calls FormatMessage) on Windows and to strerror() on other platforms. Signed-off-by: Lev Stipakov --- src/openvpn/error.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/openvpn/error.c b/src/openvpn/error.c index 54796d03..cb2a0db1 100644 --- a/src/openvpn/error.c +++ b/src/openvpn/error.c @@ -268,7 +268,7 @@ x_msg_va(const unsigned int flags, const char *format, va_list arglist) if ((flags & M_ERRNO) && e) { openvpn_snprintf(m2, ERR_BUF_SIZE, "%s: %s (errno=%d)", - m1, strerror(e), e); + m1, openvpn_strerror(e, &gc), e); SWAP; }