From ab0188fc8bbb6f397ac3aa11c9377662b7bd88b0 Mon Sep 17 00:00:00 2001 From: Giulio Benetti Date: Fri, 26 Apr 2019 10:42:20 +0200 Subject: libcamera: utils: call secure_getenv() if it exists or workaround with issetugid() When secure_getenv() is not available, need to have a workaround. Check if secure_getenv() is present, otherwise call issetugid() on its place. Signed-off-by: Giulio Benetti Reviewed-by: Kieran Bingham Reviewed-by: Laurent Pinchart [Kieran: include stdlib.h] Signed-off-by: Kieran Bingham --- src/libcamera/utils.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'src/libcamera/utils.cpp') diff --git a/src/libcamera/utils.cpp b/src/libcamera/utils.cpp index 66123b18..ef365366 100644 --- a/src/libcamera/utils.cpp +++ b/src/libcamera/utils.cpp @@ -7,8 +7,9 @@ #include "utils.h" +#include #include -#include +#include /** * \file utils.h @@ -57,10 +58,14 @@ const char *basename(const char *path) */ char *secure_getenv(const char *name) { - if (getauxval(AT_SECURE)) +#if HAVE_SECURE_GETENV + return ::secure_getenv(name); +#else + if (issetugid()) return NULL; return getenv(name); +#endif } /** -- cgit v1.2.1