]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
tests: always declare environ
authorDaniel P. Berrangé <berrange@redhat.com>
Tue, 7 Jan 2020 16:16:19 +0000 (16:16 +0000)
committerDaniel P. Berrangé <berrange@redhat.com>
Fri, 17 Jan 2020 09:59:08 +0000 (09:59 +0000)
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 <phrdina@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
tests/commandhelper.c
tests/commandtest.c

index 77cbcd4680bf21f73042624e82ccc4b0d7fc4b2d..a7a3c44e33da77819d459bf76d46f1c6f0587048 100644 (file)
@@ -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)
index 5df1aa4221d45ec71aec5358853e0a4db555e851..cc8676811e1c6d7b8e029d94ccef62f354b876a2 100644 (file)
@@ -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)
 {