You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by GitBox <gi...@apache.org> on 2021/06/15 19:11:44 UTC

[GitHub] [incubator-nuttx] xiaoxiang781216 commented on pull request #3928: binfmt: Handle argv/argv[0] == NULL correctly in exec_module

xiaoxiang781216 commented on pull request #3928:
URL: https://github.com/apache/incubator-nuttx/pull/3928#issuecomment-861763074


   > Does the logic get to binfmt/binfmt_execmodule() via posix_spawn(). It would be an error is posix_spawn() received argv == NULL now because the caller must provide the filename. Right?
   > 
   
   1. Caller must provide the valid filename, otherwise load_module fail first
   2. The fallback look reasonable for argv == NULL or argv[0] == NULL, 
   
   > Or does it get here via exec() or execv(). Should those follow the same requirement?
   
   Yes, there are some examples at the bottom of https://pubs.opengroup.org/onlinepubs/9699919799/functions/execv.html
   
   
   
   > Aren't these all errors? Doesn't argv[0] have to be the filename?
   > 
   
   Could be return error, but the fallback is reasonable.  No, otherwise, we will get two filename since nxtask_init will insert filename again.
   
   > ```
   > examples/posix_spawn/spawn_main.c:  ret = posix_spawn(&pid, filepath, &file_actions, &attr, NULL,
   > examples/posix_spawn/spawn_main.c:  ret = posix_spawn(&pid, filepath, &file_actions, &attr, NULL, NULL);
   > ```
   > 
   > and probably others.
   
   Fixed here: https://github.com/apache/incubator-nuttx-apps/pull/778


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org