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 2020/04/17 22:48:32 UTC

[GitHub] [incubator-nuttx-apps] patacongo commented on a change in pull request #185: nsh improvement

patacongo commented on a change in pull request #185: nsh improvement
URL: https://github.com/apache/incubator-nuttx-apps/pull/185#discussion_r410504235
 
 

 ##########
 File path: nshlib/nsh_fscmds.c
 ##########
 @@ -1675,8 +1687,26 @@ int cmd_rmdir(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
  ****************************************************************************/
 
 #if CONFIG_NFILE_STREAMS > 0 && !defined(CONFIG_NSH_DISABLESCRIPT)
-#ifndef CONFIG_NSH_DISABLE_SH
+#if !defined(CONFIG_NSH_DISABLE_SH) && defined(CONFIG_SYSTEM_SYSTEM)
 int cmd_sh(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
+{
+  char cmd[CONFIG_NSH_LINELEN];
+
+  strncpy(cmd, "source ", sizeof(cmd) - 1);
+  strncat(cmd, argv[1], sizeof(cmd) - 1);
+
+  return system(cmd);
 
 Review comment:
   There is a logic flaw here.  The system() call will block until the cmd is executed.  Any & or redirection on the command will not be handled.  That is incorrect and must be fixed.

----------------------------------------------------------------
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


With regards,
Apache Git Services