[libvirt] [PATCH] testutils.c: unsetenv() iff platform has it

Eric Blake eblake at redhat.com
Thu May 26 15:54:32 UTC 2016


On 05/26/2016 09:40 AM, Michal Privoznik wrote:
> I've encountered the following problem (introduced by 6326865e):
> 
> ../../tests/testutils.c: In function 'virtTestRun':
> ../../tests/testutils.c:289:5: error: implicit declaration of function 'unsetenv' [-Werror=implicit-function-declaration]
>      unsetenv("VIR_TEST_MOCK_TESTNAME");
> 
> Apparently, mingw does not have unsetenv(). Therefore we should
> call it iff we are sure platform we are building for has it.
> 
> Signed-off-by: Michal Privoznik <mprivozn at redhat.com>
> ---
> 
> This is a tentative patch. Ideally, we would use gnulib's
> implementation (like we do for setenv()), but there are some
> licensing problems right now [1]. If they are resolved before our
> release, we can just pick new gnulib. If, however, they are not,
> we can just push this patch.

Conditional ACK; this is a nice fallback if the gnulib stuff doesn't
happen fast enough for us, but is indeed something we'd revert once
gnulib is ready.

> 
> 1: https://www.redhat.com/archives/libvir-list/2016-May/msg01952.html
> 
>  tests/testutils.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/tests/testutils.c b/tests/testutils.c
> index f4fbad2..8b7bf70 100644
> --- a/tests/testutils.c
> +++ b/tests/testutils.c
> @@ -286,7 +286,9 @@ virtTestRun(const char *title,
>      }
>  #endif /* TEST_OOM */
>  
> +#ifdef HAVE_UNSETENV
>      unsetenv("VIR_TEST_MOCK_TESTNAME");
> +#endif
>      return ret;
>  }
>  
> 

-- 
Eric Blake   eblake 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: 604 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20160526/5ab54917/attachment-0001.sig>


More information about the libvir-list mailing list