This is an automated email from the ASF dual-hosted git repository. acassis pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/nuttx.git
commit 483eea3d0864f673df7a1248164742313bf1b4c8 Author: guoshichao <[email protected]> AuthorDate: Fri Feb 6 11:50:00 2026 +0800 environ: make the environ variable addressable this modification will enable us can access environ in the following format: ``` vputenv(&environ, "TZ=LOC-3"); ``` Signed-off-by: guoshichao <[email protected]> (cherry picked from commit 0c13138a9863b1a4c34ad434efc743d852162eb4 in https://github.com/xiaoxiang781216/nuttx) Port to Apache master: keep master's named parameters and the secure_getenv() declaration in stdlib.h. Assisted-by: Claude Code:claude-opus-5-5 Signed-off-by: Marco Casaroli <[email protected]> --- include/stdlib.h | 4 ++-- libs/libc/environ/env_getenvironptr.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/include/stdlib.h b/include/stdlib.h index 06a56128258..1fc622fec7a 100644 --- a/include/stdlib.h +++ b/include/stdlib.h @@ -67,7 +67,7 @@ #ifdef CONFIG_DISABLE_ENVIRON # define environ NULL #else -# define environ get_environ_ptr() +# define environ (*get_environ_ptr()) #endif #if defined(CONFIG_FS_LARGEFILE) @@ -171,7 +171,7 @@ uint32_t arc4random(void); /* Environment variable support */ -FAR char **get_environ_ptr(void); +FAR char ***get_environ_ptr(void); FAR char *getenv(FAR const char *name); FAR char *secure_getenv(FAR const char *name); int putenv(FAR const char *string); diff --git a/libs/libc/environ/env_getenvironptr.c b/libs/libc/environ/env_getenvironptr.c index 81ed2ebfe0c..33c7389a03e 100644 --- a/libs/libc/environ/env_getenvironptr.c +++ b/libs/libc/environ/env_getenvironptr.c @@ -48,7 +48,7 @@ * ****************************************************************************/ -FAR char **get_environ_ptr(void) +FAR char ***get_environ_ptr(void) { - return task_get_info()->ta_envp; + return &(task_get_info()->ta_envp); }
