On Sun, Oct 7, 2012 at 7:46 PM, Peter Hutterer <[email protected]> wrote:
> If a process is hung and doesn't respond to termination, a Kill() call must
> still try to actually kill the process. In the current code, unsuccessful
> termination would still set the state, preventing Kill() from actually
> working
>
> Signed-off-by: Peter Hutterer <[email protected]>
> ---
>  src/process.cpp | 11 +++++++----
>  1 file changed, 7 insertions(+), 4 deletions(-)
>
> diff --git a/src/process.cpp b/src/process.cpp
> index 555e56b..abd107d 100644
> --- a/src/process.cpp
> +++ b/src/process.cpp
> @@ -158,8 +158,6 @@ bool xorg::testing::Process::WaitForExit(unsigned int 
> timeout) {
>  }
>
>  bool xorg::testing::Process::KillSelf(int signal, unsigned int timeout) {
> -  bool wait_success = true;
> -
>    enum State state = GetState();
>    switch (state) {
>      case FINISHED_SUCCESS:
> @@ -184,12 +182,17 @@ bool xorg::testing::Process::KillSelf(int signal, 
> unsigned int timeout) {
>        d_->state = ERROR;
>        return false;
>      }
> -    if (timeout > 0)
> +    if (timeout > 0) {
> +      bool wait_success = true;
> +
>        wait_success = WaitForExit(timeout);
> +      if (!wait_success)
> +        return false;
> +    }
>      d_->pid = -1;
>    }
>    d_->state = TERMINATED;
> -  return wait_success;
> +  return true;
>  }
>
>  bool xorg::testing::Process::Terminate(unsigned int timeout) {

This fix looks good.

For this and the following two related patches:

Reviewed-by: Chase Douglas <[email protected]>
_______________________________________________
[email protected]: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel

Reply via email to