From: Daniel P. Berrangé Date: Tue, 7 Jan 2020 16:16:19 +0000 (+0000) Subject: tests: always declare environ X-Git-Tag: v6.1.0-rc1~490 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=2df085bf2493b296de9448ee43be11133e2e3d69;p=thirdparty%2Flibvirt.git tests: always declare environ Some UNIX platforms don't declare 'environ' in their header files. We can unconditionally declare it ourselves to avoid this problem. There is no need to do this in the aa-helper code since that is Linux only code. Reviewed-by: Pavel Hrdina Signed-off-by: Daniel P. Berrangé --- diff --git a/tests/commandhelper.c b/tests/commandhelper.c index 77cbcd4680..a7a3c44e33 100644 --- a/tests/commandhelper.c +++ b/tests/commandhelper.c @@ -31,6 +31,9 @@ #ifndef WIN32 +/* Some UNIX lack it in headers & it doesn't hurt to redeclare */ +extern char **environ; + # define VIR_FROM_THIS VIR_FROM_NONE static int envsort(const void *a, const void *b) diff --git a/tests/commandtest.c b/tests/commandtest.c index 5df1aa4221..cc8676811e 100644 --- a/tests/commandtest.c +++ b/tests/commandtest.c @@ -58,6 +58,9 @@ main(void) #else +/* Some UNIX lack it in headers & it doesn't hurt to redeclare */ +extern char **environ; + static int checkoutput(const char *testname, char *prefix) {