31 lines
972 B
Diff
31 lines
972 B
Diff
From 16a2e0603f15c4a8f4517264930c7bdea5885bae Mon Sep 17 00:00:00 2001
|
|
From: Mike Gilbert <floppym@gentoo.org>
|
|
Date: Tue, 26 Apr 2022 13:58:12 -0400
|
|
Subject: [PATCH] lib: allow safe_getenv to work for non-root users
|
|
|
|
This allows users to override settings like BLKID_FILE, as is done in
|
|
the e2fsprogs test suite.
|
|
|
|
Bug: https://bugs.gentoo.org/839825
|
|
Fixes: 035507c84b53bceb143d0923e65916cbf90979c7
|
|
Signed-off-by: Mike Gilbert <floppym@gentoo.org>
|
|
---
|
|
lib/env.c | 4 +---
|
|
1 file changed, 1 insertion(+), 3 deletions(-)
|
|
|
|
diff --git a/lib/env.c b/lib/env.c
|
|
index a3dd335bfe..37125f4d5a 100644
|
|
--- a/lib/env.c
|
|
+++ b/lib/env.c
|
|
@@ -161,9 +161,7 @@ void sanitize_env(void)
|
|
|
|
char *safe_getenv(const char *arg)
|
|
{
|
|
- uid_t ruid = getuid();
|
|
-
|
|
- if (ruid != 0 || (ruid != geteuid()) || (getgid() != getegid()))
|
|
+ if ((getuid() != geteuid()) || (getgid() != getegid()))
|
|
return NULL;
|
|
#ifdef HAVE_PRCTL
|
|
if (prctl(PR_GET_DUMPABLE, 0, 0, 0, 0) == 0)
|