forked from nuttx/nuttx-update
binfmt: Handle argv/argv[0] == NULL correctly in exec_module
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
This commit is contained in:
parent
2e49e1bc5c
commit
34f31ff3f8
1 changed files with 11 additions and 2 deletions
|
@ -168,8 +168,17 @@ int exec_module(FAR const struct binary_s *binp,
|
|||
|
||||
/* Initialize the task */
|
||||
|
||||
ret = nxtask_init(tcb, argv[0], binp->priority, NULL,
|
||||
binp->stacksize, binp->entrypt, &argv[1]);
|
||||
if (argv && argv[0])
|
||||
{
|
||||
ret = nxtask_init(tcb, argv[0], binp->priority, NULL,
|
||||
binp->stacksize, binp->entrypt, &argv[1]);
|
||||
}
|
||||
else
|
||||
{
|
||||
ret = nxtask_init(tcb, filename, binp->priority, NULL,
|
||||
binp->stacksize, binp->entrypt, argv);
|
||||
}
|
||||
|
||||
binfmt_freeargv(argv);
|
||||
if (ret < 0)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue