extcap: Fix call to child watch
authorRoland Knall <roland.knall@br-automation.com>
Thu, 11 Feb 2016 06:48:54 +0000 (07:48 +0100)
committerRoland Knall <rknall@gmail.com>
Thu, 11 Feb 2016 08:49:54 +0000 (08:49 +0000)
Child watch seems to keep executables in limbo, if extcap_cleanup
removed the watch before it could be fired at least once

Bug: 12080
Change-Id: I74afafe8545d464ec08b1043a6377a6450e4c772
Reviewed-on: https://code.wireshark.org/review/13900
Petri-Dish: Roland Knall <rknall@gmail.com>
Reviewed-by: Michal Labedzki <michal.labedzki@tieto.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Roland Knall <rknall@gmail.com>
extcap.c

index 61a4c3aa8ba157b30c342bf43ab9e259b752232b..93549ded443e3014dfcf45c6b0e77d3f5ca62214 100644 (file)
--- a/extcap.c
+++ b/extcap.c
@@ -658,12 +658,6 @@ void extcap_cleanup(capture_options * capture_opts) {
                 "Extcap [%s] - Closing spawned PID: %d", interface_opts.name,
                 interface_opts.extcap_pid);
 
-        if (interface_opts.extcap_child_watch > 0)
-        {
-            g_source_remove(interface_opts.extcap_child_watch);
-            interface_opts.extcap_child_watch = 0;
-        }
-
         if (interface_opts.extcap_pid != INVALID_EXTCAP_PID)
         {
 #ifdef _WIN32
@@ -712,7 +706,9 @@ static void extcap_child_watch_cb(GPid pid, gint status _U_, gpointer user_data)
         if (interface_opts.extcap_pid == pid)
         {
             interface_opts.extcap_pid = INVALID_EXTCAP_PID;
+            g_source_remove(interface_opts.extcap_child_watch);
             interface_opts.extcap_child_watch = 0;
+
             capture_opts->ifaces = g_array_remove_index(capture_opts->ifaces, i);
             g_array_insert_val(capture_opts->ifaces, i, interface_opts);
             break;