mirror of
https://git.libcamera.org/libcamera/libcamera.git
synced 2025-07-24 09:05:06 +03:00
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>
This commit is contained in:
parent
46bfc32157
commit
ab0188fc8b
1 changed files with 7 additions and 2 deletions
|
@ -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
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue