Check that the 'kill' call succeeded.

Thanks to Duncan Sands for spotting this.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@81328 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Mikhail Glushenkov 2009-09-09 09:51:47 +00:00
parent 6e89b6f107
commit 8add26934a
2 changed files with 13 additions and 2 deletions

View File

@ -298,7 +298,13 @@ Program::Kill(std::string* ErrMsg) {
uint64_t pid64 = reinterpret_cast<uint64_t>(Data_); uint64_t pid64 = reinterpret_cast<uint64_t>(Data_);
pid_t pid = static_cast<pid_t>(pid64); pid_t pid = static_cast<pid_t>(pid64);
return (kill(pid, SIGKILL) == 0);
if (kill(pid, SIGKILL) != 0) {
MakeErrMsg(ErrMsg, "The process couldn't be killed!");
return true;
}
return false;
} }
bool Program::ChangeStdinToBinary(){ bool Program::ChangeStdinToBinary(){

View File

@ -347,7 +347,12 @@ Program::Kill(std::string* ErrMsg) {
} }
HANDLE hProcess = reinterpret_cast<HANDLE>(Data_); HANDLE hProcess = reinterpret_cast<HANDLE>(Data_);
return TerminateProcess(hProcess, 1); if (TerminateProcess(hProcess, 1) == 0) {
MakeErrMsg(ErrMsg, "The process couldn't be killed!");
return true;
}
return false;
} }
bool Program::ChangeStdinToBinary(){ bool Program::ChangeStdinToBinary(){