On 05/11/2012 01:19 PM, Luiz Capitulino wrote:
> Currently, qemu-ga has a SIGCHLD handler that automatically reaps terminated
> children processes. The idea is to avoid having qemu-ga commands blocked
> waiting for children to terminate.
> 

> +
> +    rpid = waitpid(pid, &status, 0);

You need to worry about signals interrupting the wait.  Something like:

while ((rpid = waitpid(pid, &status, 0) == -1 && errno == EINTR) {
}


> @@ -664,9 +633,16 @@ static void guest_suspend(const char *pmutils_bin, const 
> char *sysfile_str,
>      g_free(pmutils_path);
>  
>      if (pid < 0) {
> -        error_set(err, QERR_UNDEFINED_ERROR);
> +        goto exit_err;
> +    }
> +
> +    rpid = waitpid(pid, &status, 0);
> +    if (rpid == pid && WIFEXITED(status) && !WEXITSTATUS(status)) {
>          return;

And again.

-- 
Eric Blake   ebl...@redhat.com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to