summaryrefslogtreecommitdiff
path: root/src/libcamera/utils.cpp
diff options
context:
space:
mode:
authorGiulio Benetti <giulio.benetti@micronovasrl.com>2019-04-26 10:42:20 +0200
committerKieran Bingham <kieran.bingham@ideasonboard.com>2019-04-26 14:31:59 +0200
commitab0188fc8bbb6f397ac3aa11c9377662b7bd88b0 (patch)
treec891517daca91b1fb239c5c19c3f66d6c50124ff /src/libcamera/utils.cpp
parent46bfc321578fbd828afbfb8f15f35fb4b45ebc70 (diff)
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 <giulio.benetti@micronovasrl.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> [Kieran: include stdlib.h] Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Diffstat (limited to 'src/libcamera/utils.cpp')
-rw-r--r--src/libcamera/utils.cpp9
1 files changed, 7 insertions, 2 deletions
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 <stdlib.h>
#include <string.h>
-#include <sys/auxv.h>
+#include <unistd.h>
/**
* \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
}
/**