From 5d1b5648fa900319fc4d212f2fd78562959716ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stig=20Bj=C3=B8rlykke?= Date: Sat, 7 Apr 2018 12:56:45 +0200 Subject: [PATCH] extcap: Always use byte mode in pipes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The original PipeMode parameter to CreateNamedPipe() was wrong but when running gave a correct value. The changes in g00373a1f tried to fix this parameter but this gave incorrect values. Bug: 14532 Change-Id: Ia1e8e9ba54abfcc3bd0856fd715b7c69ee54ccfe Reviewed-on: https://code.wireshark.org/review/26786 Petri-Dish: Stig Bjørlykke Reviewed-by: Gerald Combs Tested-by: Petri Dish Buildbot Reviewed-by: Stig Bjørlykke --- extcap.c | 13 ++++++------- extcap.h | 2 +- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/extcap.c b/extcap.c index 51640f8cca..a0d9d319bf 100644 --- a/extcap.c +++ b/extcap.c @@ -1410,12 +1410,12 @@ extcap_init_interfaces(capture_options *capture_opts) if (extcap_has_toolbar(interface_opts->name)) { extcap_create_pipe(interface_opts->name, &interface_opts->extcap_control_in, - EXTCAP_CONTROL_IN_PREFIX, FALSE); + EXTCAP_CONTROL_IN_PREFIX); #ifdef _WIN32 interface_opts->extcap_control_in_h = pipe_h; #endif extcap_create_pipe(interface_opts->name, &interface_opts->extcap_control_out, - EXTCAP_CONTROL_OUT_PREFIX, FALSE); + EXTCAP_CONTROL_OUT_PREFIX); #ifdef _WIN32 interface_opts->extcap_control_out_h = pipe_h; #endif @@ -1423,7 +1423,7 @@ extcap_init_interfaces(capture_options *capture_opts) /* create pipe for fifo */ if (!extcap_create_pipe(interface_opts->name, &interface_opts->extcap_fifo, - EXTCAP_PIPE_PREFIX, TRUE)) + EXTCAP_PIPE_PREFIX)) { return FALSE; } @@ -1485,7 +1485,7 @@ extcap_init_interfaces(capture_options *capture_opts) } #ifdef _WIN32 -gboolean extcap_create_pipe(const gchar *ifname, gchar **fifo, const gchar *pipe_prefix, gboolean byte_mode) +gboolean extcap_create_pipe(const gchar *ifname, gchar **fifo, const gchar *pipe_prefix) { gchar timestr[ 14 + 1 ]; time_t current_time; @@ -1511,8 +1511,7 @@ gboolean extcap_create_pipe(const gchar *ifname, gchar **fifo, const gchar *pipe pipe_h = CreateNamedPipe( utf_8to16(pipename), PIPE_ACCESS_DUPLEX | FILE_FLAG_OVERLAPPED, - (byte_mode ? (PIPE_TYPE_BYTE | PIPE_READMODE_BYTE | PIPE_WAIT) : - (PIPE_TYPE_MESSAGE | PIPE_READMODE_MESSAGE | PIPE_WAIT)), + PIPE_TYPE_BYTE | PIPE_READMODE_BYTE | PIPE_WAIT, 1, 65536, 65536, 300, &security); @@ -1532,7 +1531,7 @@ gboolean extcap_create_pipe(const gchar *ifname, gchar **fifo, const gchar *pipe return TRUE; } #else -gboolean extcap_create_pipe(const gchar *ifname, gchar **fifo, const gchar *pipe_prefix, gboolean byte_mode _U_) +gboolean extcap_create_pipe(const gchar *ifname, gchar **fifo, const gchar *pipe_prefix) { gchar *temp_name = NULL; int fd = 0; diff --git a/extcap.h b/extcap.h index 17960a10da..386955dd61 100644 --- a/extcap.h +++ b/extcap.h @@ -143,7 +143,7 @@ gboolean extcap_init_interfaces(capture_options * capture_opts); gboolean -extcap_create_pipe(const gchar *ifname, gchar **fifo, const gchar *pipe_prefix, gboolean byte_mode); +extcap_create_pipe(const gchar *ifname, gchar **fifo, const gchar *pipe_prefix); /* Clean up all if related stuff */ void