From: Selva Nair <selva.n...@gmail.com>

The correct errno can get overwritten by the call to
format_extended_socket_error() which may set errno to EAGAIN
losing the original error and cause to bypass the error reporting
below. Fix by reading the errno of interest at the top of the
function.

Reported by: Gert Doering <g...@greenie.muc.de>
Signed-off-by: Selva Nair <selva.n...@gmail.com>
---
 src/openvpn/error.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/openvpn/error.c b/src/openvpn/error.c
index 49ed1dbc..7cd35b17 100644
--- a/src/openvpn/error.c
+++ b/src/openvpn/error.c
@@ -658,6 +658,9 @@ x_check_status(int status,
 {
     const char *extended_msg = NULL;
 
+    bool crt_error = false;
+    int my_errno = openvpn_errno_maybe_crt(&crt_error);
+
     msg(x_cs_verbose_level, "%s %s returned %d",
         sock ? proto2ascii(sock->info.proto, sock->info.af, true) : "",
         description,
@@ -688,9 +691,6 @@ x_check_status(int status,
         }
 #endif
 
-        bool crt_error = false;
-        int my_errno = openvpn_errno_maybe_crt(&crt_error);
-
         if (!ignore_sys_error(my_errno, crt_error))
         {
             if (extended_msg)
-- 
2.30.2



_______________________________________________
Openvpn-devel mailing list
Openvpn-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openvpn-devel

Reply via email to