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>
This commit is contained in:

committed by
Marge Bot

parent
3e00558ef0
commit
92c24191d4
@@ -169,7 +169,7 @@ dri_create_context(struct dri_screen *screen,
|
|||||||
if (debug_get_bool_option("MESA_NO_ERROR", false) ||
|
if (debug_get_bool_option("MESA_NO_ERROR", false) ||
|
||||||
driQueryOptionb(&screen->dev->option_cache, "mesa_no_error"))
|
driQueryOptionb(&screen->dev->option_cache, "mesa_no_error"))
|
||||||
#if !defined(_WIN32)
|
#if !defined(_WIN32)
|
||||||
if (geteuid() == getuid())
|
if (__normal_user())
|
||||||
#endif
|
#endif
|
||||||
attribs.flags |= ST_CONTEXT_FLAG_NO_ERROR;
|
attribs.flags |= ST_CONTEXT_FLAG_NO_ERROR;
|
||||||
|
|
||||||
|
@@ -29,6 +29,7 @@
|
|||||||
#include "brw_vec4_tes.h"
|
#include "brw_vec4_tes.h"
|
||||||
#include "dev/intel_debug.h"
|
#include "dev/intel_debug.h"
|
||||||
#include "util/macros.h"
|
#include "util/macros.h"
|
||||||
|
#include "util/u_debug.h"
|
||||||
|
|
||||||
enum brw_reg_type
|
enum brw_reg_type
|
||||||
brw_type_for_base_type(const struct glsl_type *type)
|
brw_type_for_base_type(const struct glsl_type *type)
|
||||||
@@ -1230,7 +1231,7 @@ void
|
|||||||
backend_shader::dump_instructions(const char *name) const
|
backend_shader::dump_instructions(const char *name) const
|
||||||
{
|
{
|
||||||
FILE *file = stderr;
|
FILE *file = stderr;
|
||||||
if (name && geteuid() != 0) {
|
if (name && __normal_user()) {
|
||||||
file = fopen(name, "w");
|
file = fopen(name, "w");
|
||||||
if (!file)
|
if (!file)
|
||||||
file = stderr;
|
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,
|
* 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.
|
* 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");
|
const char *override = os_get_option("MESA_LOADER_DRIVER_OVERRIDE");
|
||||||
if (override)
|
if (override)
|
||||||
return strdup(override);
|
return strdup(override);
|
||||||
@@ -780,7 +780,7 @@ loader_open_driver_lib(const char *driver_name,
|
|||||||
const char *search_paths, *next, *end;
|
const char *search_paths, *next, *end;
|
||||||
|
|
||||||
search_paths = NULL;
|
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++) {
|
for (int i = 0; search_path_vars[i] != NULL; i++) {
|
||||||
search_paths = getenv(search_path_vars[i]);
|
search_paths = getenv(search_path_vars[i]);
|
||||||
if (search_paths)
|
if (search_paths)
|
||||||
|
@@ -34,6 +34,7 @@
|
|||||||
|
|
||||||
#include "util/compress.h"
|
#include "util/compress.h"
|
||||||
#include "util/crc32.h"
|
#include "util/crc32.h"
|
||||||
|
#include "util/u_debug.h"
|
||||||
#include "util/disk_cache.h"
|
#include "util/disk_cache.h"
|
||||||
#include "util/disk_cache_os.h"
|
#include "util/disk_cache_os.h"
|
||||||
|
|
||||||
@@ -980,7 +981,7 @@ disk_cache_enabled()
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
/* If running as a users other than the real user disable cache */
|
/* If running as a users other than the real user disable cache */
|
||||||
if (geteuid() != getuid())
|
if (!__normal_user())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
/* At user request, disable shader cache entirely. */
|
/* At user request, disable shader cache entirely. */
|
||||||
|
@@ -94,7 +94,7 @@ mesa_log_init_once(void)
|
|||||||
mesa_log_file = stderr;
|
mesa_log_file = stderr;
|
||||||
|
|
||||||
#if !DETECT_OS_WINDOWS
|
#if !DETECT_OS_WINDOWS
|
||||||
if (geteuid() == getuid()) {
|
if (__normal_user()) {
|
||||||
const char *log_file = os_get_option("MESA_LOG_FILE");
|
const char *log_file = os_get_option("MESA_LOG_FILE");
|
||||||
if (log_file) {
|
if (log_file) {
|
||||||
FILE *fp = fopen(log_file, "w");
|
FILE *fp = fopen(log_file, "w");
|
||||||
|
Reference in New Issue
Block a user