git: b4b274889145 - main - rtld: provide private getenv(3)

Konstantin Belousov kib at FreeBSD.org
Tue Aug 17 12:06:51 UTC 2021


The branch main has been updated by kib:

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

commit b4b274889145bbc559613b54e7520b95f43e51e6
Author:     Konstantin Belousov <kib at FreeBSD.org>
AuthorDate: 2021-08-16 14:02:48 +0000
Commit:     Konstantin Belousov <kib at FreeBSD.org>
CommitDate: 2021-08-17 12:05:47 +0000

    rtld: provide private getenv(3)
    
    Reviewed by:    arichardson, markj
    Sponsored by:   The FreeBSD Foundation
    MFC after:      1 week
    Differential revision:  https://reviews.freebsd.org/D31545
---
 libexec/rtld-elf/rtld-libc/Makefile.inc | 2 +-
 libexec/rtld-elf/rtld.c                 | 6 ++++++
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/libexec/rtld-elf/rtld-libc/Makefile.inc b/libexec/rtld-elf/rtld-libc/Makefile.inc
index 7ffcb6e41ec7..ade2dc962aa2 100644
--- a/libexec/rtld-elf/rtld-libc/Makefile.inc
+++ b/libexec/rtld-elf/rtld-libc/Makefile.inc
@@ -27,7 +27,7 @@ SRCS+=	rtld_libc.c
 
 # Now build the remaining files from libc:
 .PATH: ${LIBC_SRCTOP}/stdlib
-SRCS+=	reallocf.c realpath.c getenv.c merge.c reallocarray.c
+SRCS+=	reallocf.c realpath.c merge.c reallocarray.c
 # TODO: fix merge.c to build with WARNS=6
 .if ${COMPILER_TYPE} == "clang"
 CFLAGS.merge.c+=-Wno-error=null-pointer-arithmetic
diff --git a/libexec/rtld-elf/rtld.c b/libexec/rtld-elf/rtld.c
index 39c41fe0ed24..8fb99246a4c1 100644
--- a/libexec/rtld-elf/rtld.c
+++ b/libexec/rtld-elf/rtld.c
@@ -6027,6 +6027,12 @@ rtld_strerror(int errnum)
 	return (sys_errlist[errnum]);
 }
 
+char *
+getenv(const char *name)
+{
+	return (rtld_get_env_val(environ, name, strlen(name)));
+}
+
 /* malloc */
 void *
 malloc(size_t nbytes)


More information about the dev-commits-src-all mailing list