mirror of
https://github.com/apache/nuttx.git
synced 2026-06-06 16:50:55 +08:00
binfmt: Let binfmt_copyargv return error code
so the caller can distinguish the empty argument and out of memory quickly Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
This commit is contained in:
committed by
Masayuki Ishikawa
parent
774648de0f
commit
9f4bb7da97
+11
-14
@@ -142,26 +142,23 @@ int exec_module(FAR const struct binary_s *binp,
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
if (argv)
|
||||
ret = binfmt_copyargv(&argv, argv);
|
||||
if (ret < 0)
|
||||
{
|
||||
argv = binfmt_copyargv(argv);
|
||||
if (!argv)
|
||||
{
|
||||
ret = -ENOMEM;
|
||||
goto errout_with_tcb;
|
||||
}
|
||||
goto errout_with_tcb;
|
||||
}
|
||||
|
||||
/* Make a copy of the environment here */
|
||||
|
||||
if (envp || (envp = environ))
|
||||
if (envp == NULL)
|
||||
{
|
||||
envp = binfmt_copyenv(envp);
|
||||
if (!envp)
|
||||
{
|
||||
ret = -ENOMEM;
|
||||
goto errout_with_args;
|
||||
}
|
||||
envp = environ;
|
||||
}
|
||||
|
||||
ret = binfmt_copyenv(&envp, envp);
|
||||
if (ret < 0)
|
||||
{
|
||||
goto errout_with_args;
|
||||
}
|
||||
|
||||
#if defined(CONFIG_ARCH_ADDRENV) && defined(CONFIG_BUILD_KERNEL)
|
||||
|
||||
Reference in New Issue
Block a user