[NetworkManager-openvpn/th/fix-detect-version: 1/3] service: fix detection of openvpn version




commit d1942fdc94786ea412aadda2bec8f6b9b9005c85
Author: Thomas Haller <thaller redhat com>
Date:   Mon Jun 7 18:47:56 2021 +0200

    service: fix detection of openvpn version
    
    Since 2.5.0, `openvpn --version` no longer exits with
    code 1. That broke the version detection.
    
    https://github.com/OpenVPN/openvpn/commit/96ae327add16f06ac8bc28cfbf9ba0abfcc7129c

 src/nm-openvpn-service.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
---
diff --git a/src/nm-openvpn-service.c b/src/nm-openvpn-service.c
index 317abea..3aca146 100644
--- a/src/nm-openvpn-service.c
+++ b/src/nm-openvpn-service.c
@@ -548,8 +548,9 @@ openvpn_binary_detect_version (const char *exepath)
                return OPENVPN_BINARY_VERSION_UNKNOWN;
 
        if (   !WIFEXITED (exit_code)
-           || WEXITSTATUS (exit_code) != 1) {
-               /* expect return code 1 (OPENVPN_EXIT_STATUS_USAGE) */
+           || !NM_IN_SET(WEXITSTATUS (exit_code), 0, 1)) {
+               /* expect return code 1 (OPENVPN_EXIT_STATUS_USAGE).
+                * Since 2.5.0, it returns 0. */
                return OPENVPN_BINARY_VERSION_UNKNOWN;
        }
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]