Skip to content

Commit

Permalink
ws_pipe: fix return value of ws_pipe_spawn_async on error path
Browse files Browse the repository at this point in the history
The function returns a GPid, not a gboolean. Callers (mmdbresolv and
extcap) only assume WS_INVALID_PID to be invalid (as documented).

Change-Id: I40b491272a451f569864fa3259009d6d3fcce772
Fixes: v2.5.1rc0-413-g1a0987904f ("Generalize our process spawning code.")
Reviewed-on: https://code.wireshark.org/review/32933
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Tested-by: Petri Dish Buildbot
Reviewed-by: Tomasz Moń <desowin@gmail.com>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
  • Loading branch information
Lekensteyn authored and AndersBroman committed Apr 22, 2019
1 parent c77ee00 commit 51ac104
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions wsutil/ws_pipe.c
Original file line number Diff line number Diff line change
Expand Up @@ -498,15 +498,15 @@ GPid ws_pipe_spawn_async(ws_pipe_t *ws_pipe, GPtrArray *args)
if (!CreatePipe(&child_stdin_rd, &child_stdin_wr, &sa, 0))
{
g_log(LOG_DOMAIN_CAPTURE, G_LOG_LEVEL_DEBUG, "Could not create stdin handle");
return FALSE;
return WS_INVALID_PID;
}

if (!CreatePipe(&child_stdout_rd, &child_stdout_wr, &sa, 0))
{
CloseHandle(child_stdin_rd);
CloseHandle(child_stdin_wr);
g_log(LOG_DOMAIN_CAPTURE, G_LOG_LEVEL_DEBUG, "Could not create stdout handle");
return FALSE;
return WS_INVALID_PID;
}

if (!CreatePipe(&child_stderr_rd, &child_stderr_wr, &sa, 0))
Expand All @@ -516,7 +516,7 @@ GPid ws_pipe_spawn_async(ws_pipe_t *ws_pipe, GPtrArray *args)
CloseHandle(child_stdout_rd);
CloseHandle(child_stdout_wr);
g_log(LOG_DOMAIN_CAPTURE, G_LOG_LEVEL_DEBUG, "Could not create stderr handle");
return FALSE;
return WS_INVALID_PID;
}

spawn_args = g_string_sized_new(200);
Expand Down

0 comments on commit 51ac104

Please sign in to comment.