On Mon, Dec 06, 2010 at 01:03:25PM +0100, Jiri Denemark wrote:
> ---
>  tests/commandtest.c |  213 +++++++++++++++++++++++++++++++++-----------------
>  1 files changed, 140 insertions(+), 73 deletions(-)
> 
> diff --git a/tests/commandtest.c b/tests/commandtest.c
> index 9ccbcef..48c6335 100644
> --- a/tests/commandtest.c
> +++ b/tests/commandtest.c
> @@ -107,7 +107,7 @@ static int test0(const void *unused ATTRIBUTE_UNUSED)
>  
>      free(virtTestLogContentAndReset());
>      cmd = virCommandNew(abs_builddir "/commandhelper-doesnotexist");
> -    if (virCommandRun(cmd, NULL) == 0)
> +    if (!cmd || virCommandRun(cmd, NULL) == 0)

The API explicitly does *not* require you to check
!cmd after virCommandNew. virCommandRun() and other
APis will check that for you and return ENOMEM.

Daniel

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Reply via email to