tree-wide: use __normal_user() everywhere instead of writing the check manually
Cc: mesa-stable
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27346>
(cherry picked from commit 92c24191d4
)
This commit is contained in:

committed by
Eric Engestrom

parent
5bf42d1c20
commit
3f4fa5b839
@@ -994,7 +994,7 @@
|
||||
"description": "tree-wide: use __normal_user() everywhere instead of writing the check manually",
|
||||
"nominated": true,
|
||||
"nomination_type": 0,
|
||||
"resolution": 0,
|
||||
"resolution": 1,
|
||||
"main_sha": null,
|
||||
"because_sha": null,
|
||||
"notes": null
|
||||
|
@@ -169,7 +169,7 @@ dri_create_context(struct dri_screen *screen,
|
||||
if (debug_get_bool_option("MESA_NO_ERROR", false) ||
|
||||
driQueryOptionb(&screen->dev->option_cache, "mesa_no_error"))
|
||||
#if !defined(_WIN32)
|
||||
if (geteuid() == getuid())
|
||||
if (__normal_user())
|
||||
#endif
|
||||
attribs.flags |= ST_CONTEXT_FLAG_NO_ERROR;
|
||||
|
||||
|
@@ -29,6 +29,7 @@
|
||||
#include "brw_vec4_tes.h"
|
||||
#include "dev/intel_debug.h"
|
||||
#include "util/macros.h"
|
||||
#include "util/u_debug.h"
|
||||
|
||||
enum brw_reg_type
|
||||
brw_type_for_base_type(const struct glsl_type *type)
|
||||
@@ -1243,7 +1244,7 @@ void
|
||||
backend_shader::dump_instructions(const char *name) const
|
||||
{
|
||||
FILE *file = stderr;
|
||||
if (name && geteuid() != 0) {
|
||||
if (name && __normal_user()) {
|
||||
file = fopen(name, "w");
|
||||
if (!file)
|
||||
file = stderr;
|
||||
|
@@ -675,7 +675,7 @@ loader_get_driver_for_fd(int fd)
|
||||
* user's problem, but this allows vc4 simulator to run on an i965 host,
|
||||
* and may be useful for some touch testing of i915 on an i965 host.
|
||||
*/
|
||||
if (geteuid() == getuid()) {
|
||||
if (__normal_user()) {
|
||||
const char *override = os_get_option("MESA_LOADER_DRIVER_OVERRIDE");
|
||||
if (override)
|
||||
return strdup(override);
|
||||
@@ -780,7 +780,7 @@ loader_open_driver_lib(const char *driver_name,
|
||||
const char *search_paths, *next, *end;
|
||||
|
||||
search_paths = NULL;
|
||||
if (geteuid() == getuid() && search_path_vars) {
|
||||
if (__normal_user() && search_path_vars) {
|
||||
for (int i = 0; search_path_vars[i] != NULL; i++) {
|
||||
search_paths = getenv(search_path_vars[i]);
|
||||
if (search_paths)
|
||||
|
@@ -33,6 +33,7 @@
|
||||
|
||||
#include "util/compress.h"
|
||||
#include "util/crc32.h"
|
||||
#include "util/u_debug.h"
|
||||
#include "util/disk_cache.h"
|
||||
#include "util/disk_cache_os.h"
|
||||
|
||||
@@ -940,7 +941,7 @@ disk_cache_enabled()
|
||||
return false;
|
||||
|
||||
/* If running as a users other than the real user disable cache */
|
||||
if (geteuid() != getuid())
|
||||
if (!__normal_user())
|
||||
return false;
|
||||
|
||||
/* At user request, disable shader cache entirely. */
|
||||
|
@@ -94,7 +94,7 @@ mesa_log_init_once(void)
|
||||
mesa_log_file = stderr;
|
||||
|
||||
#if !DETECT_OS_WINDOWS
|
||||
if (geteuid() == getuid()) {
|
||||
if (__normal_user()) {
|
||||
const char *log_file = os_get_option("MESA_LOG_FILE");
|
||||
if (log_file) {
|
||||
FILE *fp = fopen(log_file, "w");
|
||||
|
Reference in New Issue
Block a user