]> arthur.barton.de Git - netdata.git/blobdiff - src/main.c
fixed all crashes; empty responses are now formatted properly; fixed exit procedure...
[netdata.git] / src / main.c
index 7288d073af39f19dcc9eb9d65c259ca47387fa45..d73dd5901d85a071185efae4869df6c2c2da3d3d 100755 (executable)
@@ -157,7 +157,7 @@ void kill_childs()
        if(tc_child_pid) {
                info("Killing tc-qos-helper procees");
                if(killpid(tc_child_pid, SIGTERM) != -1)
-                       waitid(tc_child_pid, 0, &info, WEXITED);
+                       waitid(P_PID, tc_child_pid, &info, WEXITED);
        }
        tc_child_pid = 0;
 
@@ -170,10 +170,14 @@ void kill_childs()
                if(cd->pid && !cd->obsolete) {
                        debug(D_EXIT, "killing %s plugin process", cd->id);
                        if(killpid(cd->pid, SIGTERM) != -1)
-                               waitid(cd->pid, 0, &info, WEXITED);
+                               waitid(P_PID, cd->pid, &info, WEXITED);
                }
        }
 
+       // if, for any reason there is any child exited
+       // catch it here
+       waitid(P_PID, 0, &info, WEXITED|WNOHANG);
+
        debug(D_EXIT, "All threads/childs stopped.");
 }