[Openvpn-devel,v2] options.c: fix msvc build error

Message ID 20210607184820.343-1-lstipakov@gmail.com
State Accepted
Headers show
Series
  • [Openvpn-devel,v2] options.c: fix msvc build error
Related show

Commit Message

Lev Stipakov June 7, 2021, 6:48 p.m.
From: Lev Stipakov <lev@openvpn.net>

Commit b7fe49c ("Do not require CA when peer-fingerprint is used") broke
msvc build by adding #ifdef within msg() macro call.

    options.c(2074,1): error C2121: '#': invalid character: possibly the result of a macro expansion
    options.c(2074,1): error C2146: syntax error: missing ')' before identifier 'ifndef'
    options.c(2074,1): error C2059: syntax error: ')'

Fix by moving #ifdef outside of msg().

Reported-by: Samuli Seppänen <samuli@openvpn.net>
Signed-off-by: Lev Stipakov <lev@openvpn.net>
---

 v2:
  - fix typo in "fingerprint"
  - remove unneeded quotation marks 

 src/openvpn/options.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

Comments

Gert Doering June 7, 2021, 7:41 p.m. | #1
Acked-by: Gert Doering <gert@greenie.muc.de>

Yeah, windows... sorry for breaking MSVC again, thanks for fixing 
the typo :-) - only compile-tested on FreeBSD.

(Adding Selva's ACK on v1, for good measure)

Your patch has been applied to the master branch.

commit 88395a8307964ad48c3841c0b2fb60dce826ebf1
Author: Lev Stipakov
Date:   Mon Jun 7 21:48:20 2021 +0300

     options.c: fix msvc build error

     Signed-off-by: Lev Stipakov <lev@openvpn.net>
     Acked-by: Gert Doering <gert@greenie.muc.de>
     Acked-by: selva.nair@gmail.com
     Message-Id: <20210607184820.343-1-lstipakov@gmail.com>
     URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg22506.html
     Signed-off-by: Gert Doering <gert@greenie.muc.de>


--
kind regards,

Gert Doering

Patch

diff --git a/src/openvpn/options.c b/src/openvpn/options.c
index 6bbe5c15..a36d270e 100644
--- a/src/openvpn/options.c
+++ b/src/openvpn/options.c
@@ -2067,11 +2067,12 @@  check_ca_required(const struct options *options)
         return;
     }
 
-    msg(M_USAGE, "You must define CA file (--ca)"
+    const char* str = "You must define CA file (--ca)"
 #ifndef ENABLE_CRYPTO_MBEDTLS
         " or CA path (--capath)"
 #endif
-        " and/or peer fingeprint verification " "(--peer-fingerprint)");
+        " and/or peer fingerprint verification (--peer-fingerprint)";
+    msg(M_USAGE, str);
 }
 
 static void