From: Ben Hutchings Date: Fri, 9 Dec 2005 00:45:24 +0000 (+0000) Subject: Changed auto_kill_proc_closer to wait for the process to exit after killing it. X-Git-Tag: 0.5~8 X-Git-Url: https://git.decadent.org.uk/gitweb/?p=videolink.git;a=commitdiff_plain;h=aa8617d3abf2042b99aaa4c880b395534169814b;hp=af6539192a3f97e3ff423a3ea9fc55dd406bee14 Changed auto_kill_proc_closer to wait for the process to exit after killing it. --- diff --git a/auto_proc.cpp b/auto_proc.cpp index 1e7d70c..ad04a12 100644 --- a/auto_proc.cpp +++ b/auto_proc.cpp @@ -15,7 +15,15 @@ void auto_kill_proc_closer::operator()(pid_t pid) const assert(pid >= -1); if (pid > 0 && waitpid(pid, NULL, WNOHANG) == 0) + { kill(pid, SIGTERM); + while (waitpid(pid, NULL, 0) == -1) + if (errno != EINTR) + { + assert(!"invalid pid in auto_kill_proc_closer"); + break; + } + } } void auto_wait_proc_closer::operator()(pid_t pid) const