]> git.ipfire.org Git - thirdparty/openvpn.git/commitdiff
Fixed some compile issues with show_library_versions()
authorJames Yonan <james@openvpn.net>
Thu, 8 May 2014 22:50:36 +0000 (16:50 -0600)
committerGert Doering <gert@greenie.muc.de>
Tue, 20 May 2014 09:11:42 +0000 (11:11 +0200)
* Refactored show_library_versions to work around the fact
  that some compilers (such as MSVC 2008) can't handle #ifdefs
  inside of macro references.

* Declare show_library_versions() in options.h because it's
  referenced by other files such as openvpn.c.

* Declare get_ssl_library_version() as returning const char *,
  to avoid loss of const qualifier in ssl_openssl.c.

Signed-off-by: James Yonan <james@openvpn.net>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <1399589436-8730-7-git-send-email-james@openvpn.net>
URL: http://article.gmane.org/gmane.network.openvpn.devel/8711
Signed-off-by: Gert Doering <gert@greenie.muc.de>
(cherry picked from commit a91a2d6ad7b139ec78d61c8616b8447847e9ecc6)

src/openvpn/options.c
src/openvpn/options.h
src/openvpn/ssl_backend.h
src/openvpn/ssl_openssl.c
src/openvpn/ssl_polarssl.c

index fe9b99d28da97877ba2c9d73c2baab7eb80645b8..57f894914be7e62c18c40926e0d6c50b3c76a00e 100644 (file)
@@ -3439,18 +3439,21 @@ usage_small (void)
 void
 show_library_versions(const unsigned int flags)
 {
-  msg (flags, "library versions: %s%s%s",
 #ifdef ENABLE_SSL
-                       get_ssl_library_version(),
+#define SSL_LIB_VER_STR get_ssl_library_version()
 #else
-                       "",
+#define SSL_LIB_VER_STR ""
 #endif
 #ifdef ENABLE_LZO
-                       ", LZO ", lzo_version_string()
+#define LZO_LIB_VER_STR ", LZO ", lzo_version_string()
 #else
-                       "", ""
+#define LZO_LIB_VER_STR "", ""
 #endif
-       );
+
+  msg (flags, "library versions: %s%s%s", SSL_LIB_VER_STR, LZO_LIB_VER_STR);
+
+#undef SSL_LIB_VER_STR
+#undef LZO_LIB_VER_STR
 }
 
 static void
index 092eac456e2a6a3ddd500c17811efa57f8c1e2f0..a3b76d30f1ab5e79d2b0262ef8b5f531920b683f 100644 (file)
@@ -691,6 +691,8 @@ void notnull (const char *arg, const char *description);
 
 void usage_small (void);
 
+void show_library_versions(const unsigned int flags);
+
 void init_options (struct options *o, const bool init_gc);
 void uninit_options (struct options *o);
 
index 37a458cc13d53b2f935753724eb404ff6e7cbb25..bfd154960e516b2b74471c41edb1273e5fc66f9f 100644 (file)
@@ -485,6 +485,6 @@ void get_highest_preference_tls_cipher (char *buf, int size);
  * return a pointer to a static memory area containing the
  * name and version number of the SSL library in use
  */
-char * get_ssl_library_version(void);
+const char * get_ssl_library_version(void);
 
 #endif /* SSL_BACKEND_H_ */
index 148185083314eb264e1fa9943a37b5f434d7cce1..3a222d85caa506471670924ef4507f751b6dec2b 100644 (file)
@@ -1439,7 +1439,7 @@ get_highest_preference_tls_cipher (char *buf, int size)
   SSL_CTX_free (ctx);
 }
 
-char *
+const char *
 get_ssl_library_version(void)
 {
     return SSLeay_version(SSLEAY_VERSION);
index 5bd6d7d22a37686c79bb7c5018e29c60950dcc58..ddccf1d9fab16495761db0219de889ada0722803 100644 (file)
@@ -1121,7 +1121,7 @@ get_highest_preference_tls_cipher (char *buf, int size)
   strncpynt (buf, cipher_name, size);
 }
 
-char *
+const char *
 get_ssl_library_version(void)
 {
     static char polar_version[30];