[Openvpn-devel] interactive.c: remove unused function

Message ID 20200229123515.9745-1-lstipakov@gmail.com
State Accepted
Headers show
Series
  • [Openvpn-devel] interactive.c: remove unused function
Related show

Commit Message

Lev Stipakov Feb. 29, 2020, 12:35 p.m.
From: Lev Stipakov <lev@openvpn.net>

Function ReturnOpenvpnOutput was used to read
openvpn process output and write it to openvpn-gui.

Commit 852f1e4 has directed stdout/stderr streams of openvpn
process to NUL, after which ReturnOpenvpnOutput() has become unused.

Signed-off-by: Lev Stipakov <lev@openvpn.net>
---
 src/openvpnserv/interactive.c | 25 -------------------------
 1 file changed, 25 deletions(-)

Comments

Selva Nair March 1, 2020, 1:11 a.m. | #1
Hi,

On Sat, Feb 29, 2020 at 7:36 AM Lev Stipakov <lstipakov@gmail.com> wrote:
>
> From: Lev Stipakov <lev@openvpn.net>
>
> Function ReturnOpenvpnOutput was used to read
> openvpn process output and write it to openvpn-gui.
>
> Commit 852f1e4 has directed stdout/stderr streams of openvpn
> process to NUL, after which ReturnOpenvpnOutput() has become unused.
>
> Signed-off-by: Lev Stipakov <lev@openvpn.net>
> ---
>  src/openvpnserv/interactive.c | 25 -------------------------
>  1 file changed, 25 deletions(-)
>
> diff --git a/src/openvpnserv/interactive.c b/src/openvpnserv/interactive.c
> index 8da49be6..1f13163e 100644
> --- a/src/openvpnserv/interactive.c
> +++ b/src/openvpnserv/interactive.c
> @@ -361,31 +361,6 @@ ReturnLastError(HANDLE pipe, LPCWSTR func)
>      ReturnError(pipe, GetLastError(), func, 1, &exit_event);
>  }
>
> -
> -static VOID
> -ReturnOpenvpnOutput(HANDLE pipe, HANDLE ovpn_output, DWORD count, LPHANDLE events)
> -{
> -    WCHAR *wide_output = NULL;
> -    CHAR output[512];
> -    DWORD size;
> -
> -    ReadFile(ovpn_output, output, sizeof(output), &size, NULL);
> -    if (size == 0)
> -    {
> -        return;
> -    }
> -
> -    wide_output = malloc((size) * sizeof(WCHAR));
> -    if (wide_output)
> -    {
> -        MultiByteToWideChar(CP_UTF8, 0, output, size, wide_output, size);
> -        wide_output[size - 1] = 0;
> -    }
> -
> -    ReturnError(pipe, ERROR_OPENVPN_STARTUP, wide_output, count, events);
> -    free(wide_output);
> -}
> -
>  /*
>   * Validate options against a white list. Also check the config_file is
>   * inside the config_dir. The white list is defined in validate.c

Makes sense to get rid of this unused static function.
Compile tested.

Acked-by: <selva.nair@gmail.com>
Gert Doering March 8, 2020, 7:29 p.m. | #2
Your patch has been applied to the master branch.

(For whatever reason, the list never delivered the original mail to me - 
so I pulled it out of patchwork, and did a quick review that "yes, this
should be what Selva has ACKed" :-) - patch makes sense, and the list
archives *do* have it... - test compiled on mingw)

commit 30be55d270c187104b3abaff407ad14f6ea11be2
Author: Lev Stipakov
Date:   Sat Feb 29 14:35:15 2020 +0200

     interactive.c: remove unused function

     Signed-off-by: Lev Stipakov <lev@openvpn.net>
     Acked-by: <selva.nair@gmail.com>
     Acked-by: Selva Nair <selva.nair@gmail.com>
     Message-Id: <20200229123515.9745-1-lstipakov@gmail.com>
     URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg19508.html
     Signed-off-by: Gert Doering <gert@greenie.muc.de>


--
kind regards,

Gert Doering

Patch

diff --git a/src/openvpnserv/interactive.c b/src/openvpnserv/interactive.c
index 8da49be6..1f13163e 100644
--- a/src/openvpnserv/interactive.c
+++ b/src/openvpnserv/interactive.c
@@ -361,31 +361,6 @@  ReturnLastError(HANDLE pipe, LPCWSTR func)
     ReturnError(pipe, GetLastError(), func, 1, &exit_event);
 }
 
-
-static VOID
-ReturnOpenvpnOutput(HANDLE pipe, HANDLE ovpn_output, DWORD count, LPHANDLE events)
-{
-    WCHAR *wide_output = NULL;
-    CHAR output[512];
-    DWORD size;
-
-    ReadFile(ovpn_output, output, sizeof(output), &size, NULL);
-    if (size == 0)
-    {
-        return;
-    }
-
-    wide_output = malloc((size) * sizeof(WCHAR));
-    if (wide_output)
-    {
-        MultiByteToWideChar(CP_UTF8, 0, output, size, wide_output, size);
-        wide_output[size - 1] = 0;
-    }
-
-    ReturnError(pipe, ERROR_OPENVPN_STARTUP, wide_output, count, events);
-    free(wide_output);
-}
-
 /*
  * Validate options against a white list. Also check the config_file is
  * inside the config_dir. The white list is defined in validate.c