You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by xi...@apache.org on 2022/04/21 10:38:47 UTC

[incubator-nuttx] 04/04: binfmt_execmodule: If incoming envp is NULL get parent envp

This is an automated email from the ASF dual-hosted git repository.

xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git

commit 1a7d81c9420f9413ee43eaa147865c98c32893be
Author: Ville Juven <vi...@unikie.com>
AuthorDate: Thu Apr 21 10:06:37 2022 +0300

    binfmt_execmodule: If incoming envp is NULL get parent envp
    
    This keeps backwards compatibility with apps that do not provide
    envp. The old implementation passes NULL always and this change fixes
    any regression caused by it.
---
 binfmt/binfmt_execmodule.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/binfmt/binfmt_execmodule.c b/binfmt/binfmt_execmodule.c
index 15da3603e2..e56903bc3f 100644
--- a/binfmt/binfmt_execmodule.c
+++ b/binfmt/binfmt_execmodule.c
@@ -153,7 +153,7 @@ int exec_module(FAR const struct binary_s *binp,
 
   /* Make a copy of the environment here */
 
-  if (envp)
+  if (envp || (envp = get_environ_ptr()))
     {
       envp = binfmt_copyenv(envp);
       if (!envp)