X-Git-Url: https://git.decadent.org.uk/gitweb/?p=videolink.git;a=blobdiff_plain;f=auto_proc.cpp;h=06abfad3b454dd11b084e129890511413352e242;hp=1e7d70c31d12820795e69337d9c5abb1b8086b17;hb=HEAD;hpb=410c2b9017bc26a7e79269c1f7fc606ad89249bb diff --git a/auto_proc.cpp b/auto_proc.cpp index 1e7d70c..06abfad 100644 --- a/auto_proc.cpp +++ b/auto_proc.cpp @@ -1,4 +1,4 @@ -// Copyright 2005 Ben Hutchings . +// Copyright 2005 Ben Hutchings . // See the file "COPYING" for licence details. #include @@ -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