diff options
author | Gerald Combs <gerald@wireshark.org> | 2018-03-02 09:11:31 -0800 |
---|---|---|
committer | Gerald Combs <gerald@wireshark.org> | 2018-03-02 18:07:58 +0000 |
commit | 80d652f06e205be070ba151158042c12adbb2d7e (patch) | |
tree | 937a17493e2c326a0716324d0770242d56dce4b0 /extcap.c | |
parent | 184ef021110d52d123104c77863df92f7ecc5f6e (diff) |
More spawned process handling updates.
Document ws_pipe.h. Define invalid PIDs in one place.
Extcap didn't use stdin before 1a0987904f. Make sure we close it.
Change-Id: I7a69cd9b5137ae82435e64628a22e4d812d58f89
Reviewed-on: https://code.wireshark.org/review/26226
Petri-Dish: Gerald Combs <gerald@wireshark.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Gerald Combs <gerald@wireshark.org>
Diffstat (limited to 'extcap.c')
-rw-r--r-- | extcap.c | 13 |
1 files changed, 7 insertions, 6 deletions
@@ -1089,13 +1089,13 @@ void extcap_if_cleanup(capture_options *capture_opts, gchar **errormsg) interface_opts->extcap_child_watch = 0; } - if (interface_opts->extcap_pid != INVALID_EXTCAP_PID) + if (interface_opts->extcap_pid != WS_INVALID_PID) { #ifdef _WIN32 TerminateProcess(interface_opts->extcap_pid, 0); #endif g_spawn_close_pid(interface_opts->extcap_pid); - interface_opts->extcap_pid = INVALID_EXTCAP_PID; + interface_opts->extcap_pid = WS_INVALID_PID; g_free(interface_opts->extcap_pipedata); interface_opts->extcap_pipedata = NULL; @@ -1147,7 +1147,7 @@ void extcap_child_watch_cb(GPid pid, gint status, gpointer user_data) pipedata = (ws_pipe_t *)interface_opts->extcap_pipedata; if (pipedata != NULL) { - interface_opts->extcap_pid = INVALID_EXTCAP_PID; + interface_opts->extcap_pid = WS_INVALID_PID; pipedata->exitcode = 0; #ifndef _WIN32 if (WIFEXITED(status)) @@ -1292,7 +1292,7 @@ extcap_init_interfaces(capture_options *capture_opts) for (i = 0; i < capture_opts->ifaces->len; i++) { GPtrArray *args = NULL; - GPid pid = INVALID_EXTCAP_PID; + GPid pid = WS_INVALID_PID; interface_opts = &g_array_index(capture_opts->ifaces, interface_options, i); @@ -1337,12 +1337,13 @@ extcap_init_interfaces(capture_options *capture_opts) g_ptr_array_foreach(args, (GFunc)g_free, NULL); g_ptr_array_free(args, TRUE); - if (pid == INVALID_EXTCAP_PID) + if (pid == WS_INVALID_PID) { g_free(pipedata); continue; } + ws_close(pipedata->stdin_fd); interface_opts->extcap_pid = pid; interface_opts->extcap_child_watch = @@ -1356,7 +1357,7 @@ extcap_init_interfaces(capture_options *capture_opts) * Wait on multiple object in case of extcap termination * without opening pipe. */ - if (pid != INVALID_EXTCAP_PID) + if (pid != WS_INVALID_PID) { HANDLE pipe_handles[3]; int num_pipe_handles = 1; |