git: 6c85003139a4 - stable/14 - rtld direct exec: make -u behavior match the description

From: Konstantin Belousov <kib_at_FreeBSD.org>
Date: Mon, 06 May 2024 04:42:47 UTC
The branch stable/14 has been updated by kib:

URL: https://cgit.FreeBSD.org/src/commit/?id=6c85003139a4917bf617916e9aad8f024d847278

commit 6c85003139a4917bf617916e9aad8f024d847278
Author:     Konstantin Belousov <kib@FreeBSD.org>
AuthorDate: 2024-04-28 20:57:54 +0000
Commit:     Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2024-05-06 04:42:19 +0000

    rtld direct exec: make -u behavior match the description
    
    (cherry picked from commit ef2694f368cee5957ee44b0298da88ff8360d561)
---
 libexec/rtld-elf/rtld.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/libexec/rtld-elf/rtld.c b/libexec/rtld-elf/rtld.c
index 0492b8f9d9f3..96042f7b5af3 100644
--- a/libexec/rtld-elf/rtld.c
+++ b/libexec/rtld-elf/rtld.c
@@ -6187,7 +6187,10 @@ parse_args(char* argv[], int argc, bool *use_pathp, int *fdp,
 			} else if (opt == 'p') {
 				*use_pathp = true;
 			} else if (opt == 'u') {
-				trust = false;
+				u_int ll;
+
+				for (ll = 0; ll < nitems(ld_env_vars); ll++)
+					ld_env_vars[ll].val = NULL;
 			} else if (opt == 'v') {
 				machine[0] = '\0';
 				mib[0] = CTL_HW;