aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTomasz Moń <desowin@gmail.com>2022-12-12 15:44:22 +0100
committerTomasz Moń <desowin@gmail.com>2022-12-12 16:54:23 +0100
commit5aa1871ee0d0e87129d77328061aebace9983cde (patch)
treec5f3135ba8d6a993c261b28a8f6d4c67992b0789
parentf0002e0e3dd5765f48be91d2aed29c554efba2aa (diff)
extcap: Do not hang if extcap doesn't open fifo
Simply open and close the fifo as part of cleanup. Doing so lets dumpcap know that the capture has finished if extcap did not open the pipe. This is only needed on *NIX systems, because there was no hang on Windows. Fixes #18715
-rw-r--r--extcap.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/extcap.c b/extcap.c
index b553127c58..ee7e469f45 100644
--- a/extcap.c
+++ b/extcap.c
@@ -1343,6 +1343,15 @@ gboolean extcap_session_stop(capture_session *cap_session)
#else
if (interface_opts->extcap_fifo != NULL && file_exists(interface_opts->extcap_fifo))
{
+ /* If extcap didn't open the fifo, dumpcap would be waiting on it
+ * until user manually stops capture. Simply open and close fifo
+ * here to let dumpcap return from the select() call. This has no
+ * effect if dumpcap is not waiting.
+ */
+ int fd = ws_open(interface_opts->extcap_fifo, O_WRONLY, 0000);
+ if (fd != -1) {
+ close(fd);
+ }
/* the fifo will not be freed here, but with the other capture_opts in capture_sync */
ws_unlink(interface_opts->extcap_fifo);
interface_opts->extcap_fifo = NULL;