diff options
author | Mikael Kanstrup <mikael.kanstrup@sony.com> | 2020-02-01 10:17:10 +0100 |
---|---|---|
committer | Peter Wu <peter@lekensteyn.nl> | 2020-02-01 17:51:02 +0000 |
commit | f5c70db3b431d128a49a65a782874e7fa55d12a6 (patch) | |
tree | 4389b1d6698ddf7c76a4231105e762ba8c743535 /extcap.c | |
parent | 4ef8ace6101d6f9fe6c83c5a8413aadcd83d23ec (diff) |
extcap: Check for valid PID before killing child process
If an extcap tool fails to start or the tool exits unexpectedly
Wireshark will try to kill PID -1. This has very unexpected results
on Linux, like bringing down the whole window manager.
Make sure it's a valid PID before killing the extcap child process.
Bug: 16362
Change-Id: I58c0cb409fec3f35d3c76d841e2430a2f8742301
Fixes: v3.3.0rc0-461-g8efde39805 ("extcap: terminate the child process using kill.")
Reviewed-on: https://code.wireshark.org/review/35998
Reviewed-by: Pascal Quantin <pascal@wireshark.org>
Petri-Dish: Pascal Quantin <pascal@wireshark.org>
Petri-Dish: Guy Harris <guy@alum.mit.edu>
Tested-by: Petri Dish Buildbot
Reviewed-by: Dario Lombardo <lomato@gmail.com>
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
Diffstat (limited to 'extcap.c')
-rw-r--r-- | extcap.c | 5 |
1 files changed, 4 insertions, 1 deletions
@@ -1220,7 +1220,10 @@ void extcap_if_cleanup(capture_options *capture_opts, gchar **errormsg) /* Send termination signal to child. On Linux and OSX the child will not notice that the * pipe has been closed before writing to the pipe. */ - kill(interface_opts->extcap_pid , SIGTERM); + if (interface_opts->extcap_pid != WS_INVALID_PID) + { + kill(interface_opts->extcap_pid, SIGTERM); + } #endif /* Maybe the client closed and removed fifo, but ws should check if * pid should be closed */ |