Skip to contentSkip to conversation

interactive.c: remove unused function

PATCH In review Lev Stipakov 3 participants 3 messages Feb 29, 2020 – Mar 8, 2020

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 interactive.c: remove unused function

From: Lev Stipakov <[email protected]...>

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.

---
 src/openvpnserv/interactive.c | 25 -------------------------
 1 file changed, 25 deletions(-)
src/openvpnserv/interactive.c +0 -25
index 8da49be6..1f13163e 100644
@@ -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
Signature · 1 line
2.17.1
Acked-by on v1 1/1
#1 lore raw

Hi,

Quoted 40 lines · Lev Stipakov

From: Lev Stipakov <[email protected]...>

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.

---
 src/openvpnserv/interactive.c | 25 -------------------------
 1 file changed, 25 deletions(-)
src/openvpnserv/interactive.c +0 -18
index 8da49be6..1f13163e 100644
@@ -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);

src/openvpnserv/interactive.c ReturnLastError(HANDLE pipe, LPCWSTR func) · line 366

Quoted 10 lines
src/openvpnserv/interactive.c +0 -7
-        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.

#2 lore raw
In reply to Lev Stipakov

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 <[email protected]...>
     Acked-by: <[email protected]...>
     Acked-by: Selva Nair <[email protected]...>
     Message-Id: <[email protected]...>
     URL: https://www.mail-archive.com/[email protected]/msg19508.html
     Signed-off-by: Gert Doering <[email protected]...>

--
kind regards,

Gert Doering