mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-20 13:50:11 +01:00
util: Provide a secure_getenv fallback for platforms without it
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27381>
(cherry picked from commit 8b209a6200)
This commit is contained in:
parent
ca8b1613b8
commit
36cad96d34
3 changed files with 10 additions and 1 deletions
|
|
@ -104,7 +104,7 @@
|
||||||
"description": "util: Provide a secure_getenv fallback for platforms without it",
|
"description": "util: Provide a secure_getenv fallback for platforms without it",
|
||||||
"nominated": false,
|
"nominated": false,
|
||||||
"nomination_type": 3,
|
"nomination_type": 3,
|
||||||
"resolution": 4,
|
"resolution": 1,
|
||||||
"main_sha": null,
|
"main_sha": null,
|
||||||
"because_sha": null,
|
"because_sha": null,
|
||||||
"notes": null
|
"notes": null
|
||||||
|
|
|
||||||
|
|
@ -1337,6 +1337,7 @@ functions_to_detect = {
|
||||||
'getrandom': '',
|
'getrandom': '',
|
||||||
'qsort_s': '',
|
'qsort_s': '',
|
||||||
'posix_fallocate': '',
|
'posix_fallocate': '',
|
||||||
|
'secure_getenv': '',
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach f, prefix: functions_to_detect
|
foreach f, prefix: functions_to_detect
|
||||||
|
|
|
||||||
|
|
@ -39,6 +39,7 @@
|
||||||
#define U_DEBUG_H_
|
#define U_DEBUG_H_
|
||||||
|
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#if !defined(_WIN32)
|
#if !defined(_WIN32)
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
|
@ -403,6 +404,13 @@ __normal_user(void)
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef HAVE_SECURE_GETENV
|
||||||
|
static inline char *secure_getenv(const char *name)
|
||||||
|
{
|
||||||
|
return getenv(name);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#define DEBUG_GET_ONCE_BOOL_OPTION(sufix, name, dfault) \
|
#define DEBUG_GET_ONCE_BOOL_OPTION(sufix, name, dfault) \
|
||||||
static bool \
|
static bool \
|
||||||
debug_get_option_ ## sufix (void) \
|
debug_get_option_ ## sufix (void) \
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue