Skip to contentSkip to conversation

Allow mingw builds with -Werror

PATCH In review Frank Lichtenheld 4 participants 17 messages Feb 3, 2023 – Feb 25, 2023 1 message not in the archive

lore
Share & tools
lore
#0 lore raw

cover Allow mingw builds with -Werror

Since I needed to test mingw builds today, I took a look into the warnings reported.

Most of those patches are trivial and straightforward. Not 100% sure whether the recv/send one is a good idea.

Frank Lichtenheld (5):
Windows: fix unused function setenv_foreign_option
Windows: fix unused variables in delete_route_ipv6
Windows: fix wrong printf format in x_check_status
Windows: fix unused variable in win32_get_arch
Windows: fix signedness errors with recv/send

 src/openvpn/error.c   |  4 ++--
 src/openvpn/manage.c  |  4 ++--
 src/openvpn/options.c |  2 ++
 src/openvpn/proxy.c   |  2 +-
 src/openvpn/route.c   | 32 ++++++++++++++++----------------
 src/openvpn/syshead.h |  2 ++
 src/openvpn/win32.c   |  7 +++----
 7 files changed, 28 insertions(+), 25 deletions(-)
Signature · 1 line
2.34.1
#1 lore raw

PATCH 1/5 Windows: fix unused function setenv_foreign_option

---
 src/openvpn/options.c | 2 ++
 1 file changed, 2 insertions(+)
src/openvpn/options.c +2 -0
index 6ae3faf8..ab1b01cf 100644
@@ -1041,6 +1041,7 @@ setenv_settings(struct env_set *es, const struct options *o)
     }
 }
 
+#ifndef _WIN32
 static void
 setenv_foreign_option(struct options *o, const char *argv[], int len, struct env_set *es)
 {
@@ -1078,6 +1079,7 @@ setenv_foreign_option(struct options *o, const char *argv[], int len, struct env
         gc_free(&gc);
     }
 }
+#endif /* ifndef _WIN32 */
 
 static in_addr_t
 get_ip_addr(const char *ip_string, int msglevel, bool *error)
Signature · 1 line
2.34.1
#4 lore raw

PATCH 2/5 Windows: fix unused variables in delete_route_ipv6

In reply to Frank Lichtenheld

At this point it might be easier to create a
dedicated function for Windows...

---
 src/openvpn/route.c | 32 ++++++++++++++++----------------
 1 file changed, 16 insertions(+), 16 deletions(-)
src/openvpn/route.c +16 -16
index 82519c94..3798bc65 100644
@@ -2333,12 +2333,6 @@ delete_route_ipv6(const struct route_ipv6 *r6, const struct tuntap *tt,
                   openvpn_net_ctx_t *ctx)
 {
     const char *network;
-#if !defined(TARGET_LINUX)
-    const char *gateway;
-#else
-    int metric;
-#endif
-    bool gateway_needed = false;
 
     if ((r6->flags & (RT_DEFINED|RT_ADDED)) != (RT_DEFINED|RT_ADDED))
     {
@@ -2346,19 +2340,34 @@ delete_route_ipv6(const struct route_ipv6 *r6, const struct tuntap *tt,
     }
 
 #ifndef _WIN32
+#if !defined(TARGET_LINUX)
+    const char *gateway;
+#else
+    int metric;
+#endif
+    bool gateway_needed = false;
     const char *device = tt->actual_name;
     if (r6->iface != NULL)              /* vpn server special route */
     {
         device = r6->iface;
         gateway_needed = true;
     }
+
+    /* if we used a gateway on "add route", we also need to specify it on
+     * delete, otherwise some OSes will refuse to delete the route
+     */
+    if (tt->type == DEV_TYPE_TAP
+        && !( (r6->flags & RT_METRIC_DEFINED) && r6->metric == 0 ) )
+    {
+        gateway_needed = true;
+    }
 #endif
 
     struct gc_arena gc = gc_new();
     struct argv argv = argv_new();
 
     network = print_in6_addr( r6->network, 0, &gc);
-#if !defined(TARGET_LINUX)
+#if !defined(TARGET_LINUX) && !defined(_WIN32)
     gateway = print_in6_addr( r6->gateway, 0, &gc);
 #endif
 
@@ -2382,15 +2391,6 @@ delete_route_ipv6(const struct route_ipv6 *r6, const struct tuntap *tt,
 
     msg( M_INFO, "delete_route_ipv6(%s/%d)", network, r6->netbits );
 
-    /* if we used a gateway on "add route", we also need to specify it on
-     * delete, otherwise some OSes will refuse to delete the route
-     */
-    if (tt->type == DEV_TYPE_TAP
-        && !( (r6->flags & RT_METRIC_DEFINED) && r6->metric == 0 ) )
-    {
-        gateway_needed = true;
-    }
-
 #if defined(TARGET_LINUX)
     metric = -1;
     if ((r6->flags & RT_METRIC_DEFINED) && (r6->metric > 0))
Signature · 1 line
2.34.1
#7 lore raw

PATCH 3/5 Windows: fix wrong printf format in x_check_status

In reply to Frank Lichtenheld
---
 src/openvpn/error.c   | 4 ++--
 src/openvpn/syshead.h | 2 ++
 2 files changed, 4 insertions(+), 2 deletions(-)
src/openvpn/error.c +2 -2
index 89a08cec..a2c9aa4c 100644
@@ -695,14 +695,14 @@ x_check_status(int status,
         {
             if (extended_msg)
             {
-                msg(x_cs_info_level, "%s %s [%s]: %s (fd=%d,code=%d)", description,
+                msg(x_cs_info_level, "%s %s [%s]: %s (fd=" SOCKET_PRINTF ",code=%d)", description,
                     sock ? proto2ascii(sock->info.proto, sock->info.af, true) : "",
                     extended_msg, openvpn_strerror(my_errno, crt_error, &gc),
                     sock ? sock->sd : -1, my_errno);
             }
             else
             {
-                msg(x_cs_info_level, "%s %s: %s (fd=%d,code=%d)", description,
+                msg(x_cs_info_level, "%s %s: %s (fd=" SOCKET_PRINTF ",code=%d)", description,
                     sock ? proto2ascii(sock->info.proto, sock->info.af, true) : "",
                     openvpn_strerror(my_errno, crt_error, &gc),
                     sock ? sock->sd : -1, my_errno);
src/openvpn/syshead.h +2 -0
index fe91bc11..58cdd6bd 100644
@@ -442,9 +442,11 @@ typedef unsigned short sa_family_t;
  */
 #ifdef _WIN32
 #define SOCKET_UNDEFINED (INVALID_SOCKET)
+#define SOCKET_PRINTF "%lld"
 typedef SOCKET socket_descriptor_t;
 #else
 #define SOCKET_UNDEFINED (-1)
+#define SOCKET_PRINTF "%d"
 typedef int socket_descriptor_t;
 #endif
 
Signature · 1 line
2.34.1
#13 lore raw

PATCH 4/5 Windows: fix unused variable in win32_get_arch

In reply to Frank Lichtenheld
---
 src/openvpn/win32.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)
src/openvpn/win32.c +3 -4
index 44176936..ad3d9bf6 100644
@@ -1358,7 +1358,6 @@ win32_get_arch(arch_t *process_arch, arch_t *host_arch)
 
     USHORT process_machine = 0;
     USHORT native_machine = 0;
-    BOOL is_wow64 = FALSE;
 
 #ifdef _ARM64_
     *process_arch = ARCH_ARM64;
@@ -1380,8 +1379,8 @@ win32_get_arch(arch_t *process_arch, arch_t *host_arch)
     if (is_wow64_process2)
     {
         /* check if we're running on arm64 or amd64 machine */
-        is_wow64 = is_wow64_process2(GetCurrentProcess(),
-                                     &process_machine, &native_machine);
+        BOOL is_wow64 = is_wow64_process2(GetCurrentProcess(),
+                                          &process_machine, &native_machine);
         if (is_wow64)
         {
             switch (native_machine)
@@ -1403,7 +1402,7 @@ win32_get_arch(arch_t *process_arch, arch_t *host_arch)
     else
     {
         BOOL w64 = FALSE;
-        is_wow64 = IsWow64Process(GetCurrentProcess(), &w64) && w64;
+        BOOL is_wow64 = IsWow64Process(GetCurrentProcess(), &w64) && w64;
         if (is_wow64)
         {
             /* we are unable to differentiate between arm64 and amd64
Signature · 1 line
2.34.1
#16 lore raw

PATCH 5/5 Windows: fix signedness errors with recv/send

In reply to Frank Lichtenheld

On Linux those functions actually take void pointer, so no behavior change there. On Windows, we avoid warnings about unsigned char vs char.

---
 src/openvpn/manage.c | 4 ++--
 src/openvpn/proxy.c  | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)
src/openvpn/manage.c +2 -2
index 8397d3cf..3ea1992b 100644
@@ -2251,7 +2251,7 @@ man_read(struct management *man)
         man->connection.lastfdreceived = fd;
     }
 #else  /* ifdef TARGET_ANDROID */
-    len = recv(man->connection.sd_cli, buf, sizeof(buf), MSG_NOSIGNAL);
+    len = recv(man->connection.sd_cli, (void *)buf, sizeof(buf), MSG_NOSIGNAL);
 #endif
 
     if (len == 0)
@@ -2348,7 +2348,7 @@ man_write(struct management *man)
         }
         else
 #endif
-        sent = send(man->connection.sd_cli, BPTR(buf), len, MSG_NOSIGNAL);
+        sent = send(man->connection.sd_cli, (const void *)BPTR(buf), len, MSG_NOSIGNAL);
         if (sent >= 0)
         {
             buffer_list_advance(man->connection.out, sent);
src/openvpn/proxy.c +1 -1
index aa10363c..ed47eaa2 100644
@@ -126,7 +126,7 @@ recv_line(socket_descriptor_t sd,
         }
 
         /* read single char */
-        size = recv(sd, &c, 1, MSG_NOSIGNAL);
+        size = recv(sd, (void *)&c, 1, MSG_NOSIGNAL);
 
         /* error? */
         if (size != 1)
Signature · 1 line
2.34.1
Acked-by on v1 1/5
#2 lore raw

Re: [Openvpn-devel] [PATCH 1/5] Windows: fix unused function setenv_foreign_option

In reply to Frank Lichtenheld

I haven't tested it in the MinGW environment, but checked the code in MSVC and ensured that setenv_foreign_option is indeed not used at all in Win32.

pe 3. helmik. 2023 klo 21.15 Frank Lichtenheld ([email protected]...) kirjoitti:

Quoted 35 lines
---
 src/openvpn/options.c | 2 ++
 1 file changed, 2 insertions(+)
src/openvpn/options.c +2 -1
index 6ae3faf8..ab1b01cf 100644
@@ -1041,6 +1041,7 @@ setenv_settings(struct env_set *es, const struct options *o)
     }
 }
 
+#ifndef _WIN32
 static void
 setenv_foreign_option(struct options *o, const char *argv[], int len, struct env_set *es)
 {
@@ -1078,6 +1079,7 @@ setenv_foreign_option(struct options *o, const char *argv[], int len, struct env
         gc_free(&gc);
     }
 }
+#endif /* ifndef _WIN32 */
 
 static in_addr_t
 get_ip_addr(const char *ip_string, int msglevel, bool *error)
--

2.34.1

_______________________________________________
Openvpn-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openvpn-devel

Signature · 1 line
-Lev
Acked-by on v1 2/5
#5 lore raw

Re: [Openvpn-devel] [PATCH 2/5] Windows: fix unused variables in delete_route_ipv6

In reply to Frank Lichtenheld

Looks good. Stared at the code and test-compiled with MSVC.

pe 3. helmik. 2023 klo 21.15 Frank Lichtenheld ([email protected]...) kirjoitti:

Quoted 87 lines

At this point it might be easier to create a
dedicated function for Windows...

---
 src/openvpn/route.c | 32 ++++++++++++++++----------------
 1 file changed, 16 insertions(+), 16 deletions(-)
src/openvpn/route.c +16 -17
index 82519c94..3798bc65 100644
@@ -2333,12 +2333,6 @@ delete_route_ipv6(const struct route_ipv6 *r6, const struct tuntap *tt,
                   openvpn_net_ctx_t *ctx)
 {
     const char *network;
-#if !defined(TARGET_LINUX)
-    const char *gateway;
-#else
-    int metric;
-#endif
-    bool gateway_needed = false;
 
     if ((r6->flags & (RT_DEFINED|RT_ADDED)) != (RT_DEFINED|RT_ADDED))
     {
@@ -2346,19 +2340,34 @@ delete_route_ipv6(const struct route_ipv6 *r6, const struct tuntap *tt,
     }
 
 #ifndef _WIN32
+#if !defined(TARGET_LINUX)
+    const char *gateway;
+#else
+    int metric;
+#endif
+    bool gateway_needed = false;
     const char *device = tt->actual_name;
     if (r6->iface != NULL)              /* vpn server special route */
     {
         device = r6->iface;
         gateway_needed = true;
     }
+
+    /* if we used a gateway on "add route", we also need to specify it on
+     * delete, otherwise some OSes will refuse to delete the route
+     */
+    if (tt->type == DEV_TYPE_TAP
+        && !( (r6->flags & RT_METRIC_DEFINED) && r6->metric == 0 ) )
+    {
+        gateway_needed = true;
+    }
 #endif
 
     struct gc_arena gc = gc_new();
     struct argv argv = argv_new();
 
     network = print_in6_addr( r6->network, 0, &gc);
-#if !defined(TARGET_LINUX)
+#if !defined(TARGET_LINUX) && !defined(_WIN32)
     gateway = print_in6_addr( r6->gateway, 0, &gc);
 #endif
 
@@ -2382,15 +2391,6 @@ delete_route_ipv6(const struct route_ipv6 *r6, const struct tuntap *tt,
 
     msg( M_INFO, "delete_route_ipv6(%s/%d)", network, r6->netbits );
 
-    /* if we used a gateway on "add route", we also need to specify it on
-     * delete, otherwise some OSes will refuse to delete the route
-     */
-    if (tt->type == DEV_TYPE_TAP
-        && !( (r6->flags & RT_METRIC_DEFINED) && r6->metric == 0 ) )
-    {
-        gateway_needed = true;
-    }
-
 #if defined(TARGET_LINUX)
     metric = -1;
     if ((r6->flags & RT_METRIC_DEFINED) && (r6->metric > 0))
--

2.34.1

_______________________________________________
Openvpn-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openvpn-devel

Signature · 1 line
-Lev
Acked-by on v1 4/5
#14 lore raw

Re: [Openvpn-devel] [PATCH 4/5] Windows: fix unused variable in win32_get_arch

In reply to Frank Lichtenheld

Clear enough.

pe 3. helmik. 2023 klo 21.15 Frank Lichtenheld ([email protected]...) kirjoitti:

Quoted 47 lines
---
 src/openvpn/win32.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)
src/openvpn/win32.c +3 -5
index 44176936..ad3d9bf6 100644
@@ -1358,7 +1358,6 @@ win32_get_arch(arch_t *process_arch, arch_t *host_arch)
 
     USHORT process_machine = 0;
     USHORT native_machine = 0;
-    BOOL is_wow64 = FALSE;
 
 #ifdef _ARM64_
     *process_arch = ARCH_ARM64;
@@ -1380,8 +1379,8 @@ win32_get_arch(arch_t *process_arch, arch_t *host_arch)
     if (is_wow64_process2)
     {
         /* check if we're running on arm64 or amd64 machine */
-        is_wow64 = is_wow64_process2(GetCurrentProcess(),
-                                     &process_machine, &native_machine);
+        BOOL is_wow64 = is_wow64_process2(GetCurrentProcess(),
+                                          &process_machine, &native_machine);
         if (is_wow64)
         {
             switch (native_machine)
@@ -1403,7 +1402,7 @@ win32_get_arch(arch_t *process_arch, arch_t *host_arch)
     else
     {
         BOOL w64 = FALSE;
-        is_wow64 = IsWow64Process(GetCurrentProcess(), &w64) && w64;
+        BOOL is_wow64 = IsWow64Process(GetCurrentProcess(), &w64) && w64;
         if (is_wow64)
         {
             /* we are unable to differentiate between arm64 and amd64
--

2.34.1

_______________________________________________
Openvpn-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openvpn-devel

Signature · 1 line
-Lev
#8 lore raw

PATCH v2 3/5 Windows: fix wrong printf format in x_check_status

In reply to Frank Lichtenheld

Relevant defines/typedefs:
typedef UINT_PTR SOCKET;
if defined(_WIN64)
typedef unsigned __int64 UINT_PTR;
else
typedef unsigned int UINT_PTR;
endif
ifdef _WIN64
define PRIuPTR PRIu64
else
define PRIuPTR PRIu32
endif

Remove duplicated include of inttypes.h

---
 src/openvpn/error.c   | 4 ++--
 src/openvpn/syshead.h | 3 ++-
 2 files changed, 4 insertions(+), 3 deletions(-)

v2:
- use PRIuPTR as discussed on IRC (added relevant defines to commit message)
- remove redundant include for inttypes.h from syshead.h

src/openvpn/error.c +2 -2
index 89a08cec..a2c9aa4c 100644
@@ -695,14 +695,14 @@ x_check_status(int status,
         {
             if (extended_msg)
             {
-                msg(x_cs_info_level, "%s %s [%s]: %s (fd=%d,code=%d)", description,
+                msg(x_cs_info_level, "%s %s [%s]: %s (fd=" SOCKET_PRINTF ",code=%d)", description,
                     sock ? proto2ascii(sock->info.proto, sock->info.af, true) : "",
                     extended_msg, openvpn_strerror(my_errno, crt_error, &gc),
                     sock ? sock->sd : -1, my_errno);
             }
             else
             {
-                msg(x_cs_info_level, "%s %s: %s (fd=%d,code=%d)", description,
+                msg(x_cs_info_level, "%s %s: %s (fd=" SOCKET_PRINTF ",code=%d)", description,
                     sock ? proto2ascii(sock->info.proto, sock->info.af, true) : "",
                     openvpn_strerror(my_errno, crt_error, &gc),
                     sock ? sock->sd : -1, my_errno);
src/openvpn/syshead.h +2 -1
index fe91bc11..12ccf2f4 100644
@@ -48,7 +48,6 @@
 #ifdef _MSC_VER /* Visual Studio */
 #define __func__ __FUNCTION__
 #define __attribute__(x)
-#include <inttypes.h>
 #endif
 
 #if defined(__APPLE__)
@@ -442,9 +441,11 @@ typedef unsigned short sa_family_t;
  */
 #ifdef _WIN32
 #define SOCKET_UNDEFINED (INVALID_SOCKET)
+#define SOCKET_PRINTF "%" PRIuPTR
 typedef SOCKET socket_descriptor_t;
 #else
 #define SOCKET_UNDEFINED (-1)
+#define SOCKET_PRINTF "%d"
 typedef int socket_descriptor_t;
 #endif
 
Signature · 1 line
2.34.1
Acked-by on v2 3/5
#9 lore raw

Re: [Openvpn-devel] [PATCH v2 3/5] Windows: fix wrong printf format in x_check_status

Looks good, looked at the code test-compiled in MSVC.

ti 7. helmik. 2023 klo 15.44 Frank Lichtenheld ([email protected]...) kirjoitti:

Quoted 81 lines

Relevant defines/typedefs:
typedef UINT_PTR SOCKET;
if defined(_WIN64)
typedef unsigned __int64 UINT_PTR;
else
typedef unsigned int UINT_PTR;
endif
ifdef _WIN64
define PRIuPTR PRIu64
else
define PRIuPTR PRIu32
endif

Remove duplicated include of inttypes.h

---
 src/openvpn/error.c   | 4 ++--
 src/openvpn/syshead.h | 3 ++-
 2 files changed, 4 insertions(+), 3 deletions(-)

v2:
- use PRIuPTR as discussed on IRC (added relevant defines to commit message)
- remove redundant include for inttypes.h from syshead.h

src/openvpn/error.c +2 -2
index 89a08cec..a2c9aa4c 100644
@@ -695,14 +695,14 @@ x_check_status(int status,
         {
             if (extended_msg)
             {
-                msg(x_cs_info_level, "%s %s [%s]: %s (fd=%d,code=%d)", description,
+                msg(x_cs_info_level, "%s %s [%s]: %s (fd=" SOCKET_PRINTF ",code=%d)", description,
                     sock ? proto2ascii(sock->info.proto, sock->info.af, true) : "",
                     extended_msg, openvpn_strerror(my_errno, crt_error, &gc),
                     sock ? sock->sd : -1, my_errno);
             }
             else
             {
-                msg(x_cs_info_level, "%s %s: %s (fd=%d,code=%d)", description,
+                msg(x_cs_info_level, "%s %s: %s (fd=" SOCKET_PRINTF ",code=%d)", description,
                     sock ? proto2ascii(sock->info.proto, sock->info.af, true) : "",
                     openvpn_strerror(my_errno, crt_error, &gc),
                     sock ? sock->sd : -1, my_errno);
src/openvpn/syshead.h +2 -2
index fe91bc11..12ccf2f4 100644
@@ -48,7 +48,6 @@
 #ifdef _MSC_VER /* Visual Studio */
 #define __func__ __FUNCTION__
 #define __attribute__(x)
-#include <inttypes.h>
 #endif
 
 #if defined(__APPLE__)
@@ -442,9 +441,11 @@ typedef unsigned short sa_family_t;
  */
 #ifdef _WIN32
 #define SOCKET_UNDEFINED (INVALID_SOCKET)
+#define SOCKET_PRINTF "%" PRIuPTR
 typedef SOCKET socket_descriptor_t;
 #else
 #define SOCKET_UNDEFINED (-1)
+#define SOCKET_PRINTF "%d"
 typedef int socket_descriptor_t;
 #endif
 
--

2.34.1

_______________________________________________
Openvpn-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openvpn-devel

Signature · 1 line
-Lev
#3 lore raw

[Openvpn-devel] [PATCH applied] Re: Windows: fix unused function setenv_foreign_option

In reply to Frank Lichtenheld

Tested on plain linux (which needs setenv_foreign_option) and MingW (which no longer warns) compile. Trivial enough.

Your patch has been applied to the master and release/2.6 branch.

commit 8aeec3aa36873489d3e708ae694c57e59b4302ef (master) commit b9d35055eae676790f3bc214c00a01f756b0cd55 (release/2.6)

Author: Frank Lichtenheld
Date:   Fri Feb 3 20:14:36 2023 +0100
     Windows: fix unused function setenv_foreign_option

     Signed-off-by: Frank Lichtenheld <[email protected]...>
     Acked-by: Lev Stipakov <[email protected]...>
     Message-Id: <[email protected]...>
     URL: https://www.mail-archive.com/[email protected]/msg26145.html
     Signed-off-by: Gert Doering <[email protected]...>

--
kind regards,

Gert Doering

#6 lore raw

[Openvpn-devel] [PATCH applied] Re: Windows: fix unused variables in delete_route_ipv6

In reply to Frank Lichtenheld

Test compiled on mingw & linux, and pushed to the buildbots. This is the sort of cross-platform patch that looks harmless and breaks somewhere :-) (but it didn't).

We normally try to avoid refactoring in the middle of a release branch, but "we're between .0 and .1, and it's very trivial code movearound only".

Your patch has been applied to the master branch and release/2.6.

commit 48495ce3cd8d53663c56d265ef6a82234878e205 (master) commit ab46bdd1ef9951b684782de00f37fec4092fd0f1 (release/2.6)

Author: Frank Lichtenheld
Date:   Fri Feb 3 20:14:37 2023 +0100
     Windows: fix unused variables in delete_route_ipv6

     Signed-off-by: Frank Lichtenheld <[email protected]...>
     Acked-by: Lev Stipakov <[email protected]...>
     Message-Id: <[email protected]...>
     URL: https://www.mail-archive.com/[email protected]/msg26140.html
     Signed-off-by: Gert Doering <[email protected]...>

--
kind regards,

Gert Doering

#10 lore raw

[Openvpn-devel] [PATCH applied] Re: Windows: fix wrong printf format in x_check_status

In reply to Frank Lichtenheld

Test built on MinGW and Linux. Haven't actually tried to trigger an error message which would contain a fd=nnn output, but for "non windows" this is a no-op change, and "for windows" it looks correct.

Your patch has been applied to the master and release/2.6 branch.

commit a95705be85cb1d3a5868efaeb960ec5d625d2f11 (master) commit 37e23c9816754ceeb67d5365b639f0b37f804591 (release/2.6)

Author: Frank Lichtenheld
Date:   Tue Feb 7 14:43:33 2023 +0100
     Windows: fix wrong printf format in x_check_status

     Signed-off-by: Frank Lichtenheld <[email protected]...>
     Acked-by: Lev Stipakov <[email protected]...>
     Message-Id: <[email protected]...>
     URL: https://www.mail-archive.com/[email protected]/msg26166.html
     Signed-off-by: Gert Doering <[email protected]...>

--
kind regards,

Gert Doering

#15 lore raw

[Openvpn-devel] [PATCH applied] Re: Windows: fix unused variable in win32_get_arch

In reply to Frank Lichtenheld

"Clear enough", indeed. Test compiled on MinGW.

Your patch has been applied to the master and release/2.6 branch.

commit 2dc2d16559b41d56f662d7cd69ea547e804e27b8 (master) commit 4718af50bb7b5a913ae4befb2d3a8dd338b3eb74 (release/2.6)

Author: Frank Lichtenheld
Date:   Fri Feb 3 20:14:39 2023 +0100
     Windows: fix unused variable in win32_get_arch

     Signed-off-by: Frank Lichtenheld <[email protected]...>
     Acked-by: Lev Stipakov <[email protected]...>
     Message-Id: <[email protected]...>
     URL: https://www.mail-archive.com/[email protected]/msg26141.html
     Signed-off-by: Gert Doering <[email protected]...>

--
kind regards,

Gert Doering

#12 lore raw

PATCH v2 3/5 Windows: fix wrong printf format in x_check_status

In reply to a message not in the archive
CC list

---------- Forwarded message ---------
From: Selva Nair <[email protected]...>
Date: Tue, Feb 7, 2023 at 11:57 AM
Subject: Re: [Openvpn-devel] [PATCH v2 3/5] Windows: fix wrong printf format in x_check_status
To: Frank Lichtenheld <[email protected]...>

Nitpicking:

Quoted 3 lines

- use PRIuPTR as discussed on IRC (added relevant defines to commit message)

The most interesting value to log for SOCKET on Windows is INVALID_SOCKET = ~0 (i.e, -1). It will print with PRIuPTR as 18446744073709551615. PRIdPTR which will give -1 or PRIxPTR (ffff....ffff) may be better in this case? Though socket is a handle on Windows, I think it never gets too large to be -ve except for this special value.

I'm fine with this too as unsigned decimals for -1 in both 32 bit and 64 bit are not hard to spot.

Selva

Acked-by on v1 5/5
#17 lore raw

[Openvpn-devel] [PATCH applied] Re: Windows: fix signedness errors with recv/send

In reply to Frank Lichtenheld

I'm not a big fan of adding (cast) to silence compiler warnings, but this signed/unsigned char * nonsense is really hard to avoid - casting to (void *) is the right fix here.

I have only test compiled on MinGW - and my MinGW did not warn about these anyway (maybe not enough -Wthing switches). But it did not break anything, and does not introduce new warnings.

Your patch has been applied to the master and release/2.6 branch.

commit 7acd93a6bef2dd9b660571c29b5f41c8ca351161 (master) commit e9ae7cee2ca9b9ab78de01f1d3c562610e5624d2 (release/2.6)

Author: Frank Lichtenheld
Date:   Fri Feb 3 20:14:40 2023 +0100
     Windows: fix signedness errors with recv/send

     Signed-off-by: Frank Lichtenheld <[email protected]...>
     Acked-by: Gert Doering <[email protected]...>
     Message-Id: <[email protected]...>
     URL: https://www.mail-archive.com/[email protected]/msg26144.html
     Signed-off-by: Gert Doering <[email protected]...>

--
kind regards,

Gert Doering