diff --git a/.pick_status.json b/.pick_status.json index efa4a3a9d83..f052f8174fa 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -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 diff --git a/src/gallium/frontends/dri/dri_context.c b/src/gallium/frontends/dri/dri_context.c index 1ffaded9174..2bdb83e89e9 100644 --- a/src/gallium/frontends/dri/dri_context.c +++ b/src/gallium/frontends/dri/dri_context.c @@ -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; diff --git a/src/intel/compiler/brw_shader.cpp b/src/intel/compiler/brw_shader.cpp index 423c1976b7c..fd7ede0d086 100644 --- a/src/intel/compiler/brw_shader.cpp +++ b/src/intel/compiler/brw_shader.cpp @@ -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; diff --git a/src/loader/loader.c b/src/loader/loader.c index 4b8f532fe74..19c456c7020 100644 --- a/src/loader/loader.c +++ b/src/loader/loader.c @@ -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) diff --git a/src/util/disk_cache_os.c b/src/util/disk_cache_os.c index 20467785091..25defe8c6cc 100644 --- a/src/util/disk_cache_os.c +++ b/src/util/disk_cache_os.c @@ -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. */ diff --git a/src/util/log.c b/src/util/log.c index 96ee7cf98b7..571c0b74a7e 100644 --- a/src/util/log.c +++ b/src/util/log.c @@ -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");