[libcamera-devel] [PATCH 4/4] libcamera: log: Fallback to getenv on non-gnu systems

Kieran Bingham kieran.bingham at ideasonboard.com
Fri Mar 22 11:43:50 CET 2019


The secure_getenv() call is not provided by all toolchains. Support
compilation without this feature by falling back to the default getenv()
functionality.

Signed-off-by: Kieran Bingham <kieran.bingham at ideasonboard.com>
---
 src/libcamera/log.cpp | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/src/libcamera/log.cpp b/src/libcamera/log.cpp
index 7d930cd6b99e..a44bd941e615 100644
--- a/src/libcamera/log.cpp
+++ b/src/libcamera/log.cpp
@@ -49,6 +49,15 @@
 
 namespace libcamera {
 
+
+/*
+ * secure_getenv is a GNU-specific extension to the C-Library.
+ * fall back to the default getenv when it is not available.
+ */
+#ifndef HAVE_SECURE_GETENV
+#define secure_getenv getenv
+#endif
+
 /**
  * \brief Message logger
  *
-- 
2.19.1



More information about the libcamera-devel mailing list