[Openvpn-devel] openvpnmsica: Simplify find_adapters() to void return

Message ID 20200924065519.1839-1-simon@rozman.si
State Accepted
Headers show
Series
  • [Openvpn-devel] openvpnmsica: Simplify find_adapters() to void return
Related show

Commit Message

Simon Rozman via Openvpn-devel Sept. 24, 2020, 6:55 a.m.
As the find_adapters() failure is not critical and FindSystemInfo()
should continue regardless, the find_adapters() has been simplified not
to return result code. It still logs any error thou.

Signed-off-by: Simon Rozman <simon@rozman.si>
---
 src/openvpnmsica/openvpnmsica.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

Comments

Lev Stipakov Sept. 24, 2020, 9:31 a.m. | #1
Hi,

> to return result code. It still logs any error thou.

though

> -static UINT
> +static void

Indeed, the return value of find_adapters() has never been used.

Compiled with MSVC.

Acked-by: Lev Stipakov <lstipakov@gmail.com>
Gert Doering Sept. 24, 2020, 11:42 a.m. | #2
Indeed, that looks simple and straightforward :-) - compile
tested on MinGW.

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

commit 7f7b05395c3eb634e198d12e212360958c3ca8fb (master)
commit 29e61986af6bfe4ca41163c4a1c74d90b1b0bdea (release/2.5)
Author: Simon Rozman via Openvpn-devel
Date:   Thu Sep 24 08:55:19 2020 +0200

     openvpnmsica: Simplify find_adapters() to void return

     Signed-off-by: Simon Rozman <simon@rozman.si>
     Acked-by: Lev Stipakov <lstipakov@gmail.com>
     Message-Id: <20200924065519.1839-1-simon@rozman.si>
     URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg21077.html
     Signed-off-by: Gert Doering <gert@greenie.muc.de>


--
kind regards,

Gert Doering

Patch

diff --git a/src/openvpnmsica/openvpnmsica.c b/src/openvpnmsica/openvpnmsica.c
index f203f736..de1cf65c 100644
--- a/src/openvpnmsica/openvpnmsica.c
+++ b/src/openvpnmsica/openvpnmsica.c
@@ -248,7 +248,7 @@  cleanup_OpenSCManager:
 }
 
 
-static UINT
+static void
 find_adapters(
     _In_ MSIHANDLE hInstall,
     _In_z_ LPCTSTR szzHardwareIDs,
@@ -262,12 +262,12 @@  find_adapters(
     uiResult = tap_list_adapters(NULL, szzHardwareIDs, &pAdapterList);
     if (uiResult != ERROR_SUCCESS)
     {
-        return uiResult;
+        return;
     }
     else if (pAdapterList == NULL)
     {
         /* No adapters - no fun. */
-        return ERROR_SUCCESS;
+        return;
     }
 
     /* Get IPv4/v6 info for all network adapters. Actually, we're interested in link status only: up/down? */
@@ -394,7 +394,6 @@  cleanup_pAdapterAdresses:
     free(pAdapterAdresses);
 cleanup_pAdapterList:
     tap_free_adapter_list(pAdapterList);
-    return uiResult;
 }