[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

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



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 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.

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;
 }
 
-- 
2.8.3


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]