[libvirt] [re-send][PATCH 2/3] use WIFEXITED macro to see exit status of child

Eric Blake eblake at redhat.com
Tue Oct 9 02:05:47 UTC 2012


On 10/08/2012 07:51 PM, liguang wrote:
> this usage was suggested by man-page of waitpid,
> returns  true  if  the  child terminated normally

NACK.  virCommandRun already did this for you.

> 
> Signed-off-by: liguang <lig.fnst at cn.fujitsu.com>
> ---
>  src/util/hooks.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/src/util/hooks.c b/src/util/hooks.c
> index f5890d2..55b98ca 100644
> --- a/src/util/hooks.c
> +++ b/src/util/hooks.c
> @@ -280,7 +280,7 @@ virHookCall(int driver,
>          virCommandSetOutputBuffer(cmd, output);
>  
>      ret = virCommandRun(cmd, &exitstatus);
> -    if (ret == 0 && exitstatus != 0) {
> +    if (ret == 0 && WIFEXITED(exitstatus) == 0) {
>          virReportError(VIR_ERR_HOOK_SCRIPT_FAILED,
>                         _("Hook script %s %s failed with error code %d"),
>                         path, drvstr, exitstatus);
> 

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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 617 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20121008/6b437639/attachment-0001.sig>


More information about the libvir-list mailing list