On macOS, environ is not declared. Use the workaround suggested here:
https://www.gnu.org/software/gnulib/manual/html_node/environ.html
Signed-off-by: Antonio Caggiano <quic_acaggian(a)quicinc.com>
---
lib/guestfs-internal.h | 5 +++++
lib/handle.c | 1 +
2 files changed, 6 insertions(+)
diff --git a/lib/guestfs-internal.h b/lib/guestfs-internal.h
index 57f0eb173..174ca135f 100644
--- a/lib/guestfs-internal.h
+++ b/lib/guestfs-internal.h
@@ -26,6 +26,11 @@
#ifndef GUESTFS_INTERNAL_H_
#define GUESTFS_INTERNAL_H_
+#ifdef __APPLE__
+#include <crt_externs.h>
+#define environ (*_NSGetEnviron())
+#endif // __APPLE__
+
#include <stdbool.h>
#include <assert.h>
diff --git a/lib/handle.c b/lib/handle.c
index f1f33e737..df8e4284f 100644
--- a/lib/handle.c
+++ b/lib/handle.c
@@ -27,6 +27,7 @@
#include <stdlib.h>
#include <string.h>
#include <libintl.h>
+#include <errno.h>
#include <libxml/parser.h>
#include <libxml/xmlversion.h>
--
2.45.1