diff --git a/nshlib/nsh_console.c b/nshlib/nsh_console.c index 8489d0d51..786c344e2 100644 --- a/nshlib/nsh_console.c +++ b/nshlib/nsh_console.c @@ -463,8 +463,8 @@ FAR struct console_stdio_s *nsh_newconsole(void) #ifndef CONFIG_NSH_DISABLEBG pstate->cn_vtbl.clone = nsh_consoleclone; - pstate->cn_vtbl.release = nsh_consolerelease; #endif + pstate->cn_vtbl.release = nsh_consolerelease; pstate->cn_vtbl.write = nsh_consolewrite; pstate->cn_vtbl.output = nsh_consoleoutput; pstate->cn_vtbl.error = nsh_erroroutput; diff --git a/nshlib/nsh_console.h b/nshlib/nsh_console.h index 510e26f0b..49b31f71d 100644 --- a/nshlib/nsh_console.h +++ b/nshlib/nsh_console.h @@ -123,8 +123,8 @@ struct nsh_vtbl_s #ifndef CONFIG_NSH_DISABLEBG FAR struct nsh_vtbl_s *(*clone)(FAR struct nsh_vtbl_s *vtbl); void (*addref)(FAR struct nsh_vtbl_s *vtbl); - void (*release)(FAR struct nsh_vtbl_s *vtbl); #endif + void (*release)(FAR struct nsh_vtbl_s *vtbl); ssize_t (*write)(FAR struct nsh_vtbl_s *vtbl, FAR const void *buffer, size_t nbytes); int (*error)(FAR struct nsh_vtbl_s *vtbl, FAR const char *fmt, ...); diff --git a/nshlib/nsh_telnetd.c b/nshlib/nsh_telnetd.c index 05159931e..a633fa0b3 100644 --- a/nshlib/nsh_telnetd.c +++ b/nshlib/nsh_telnetd.c @@ -241,6 +241,9 @@ int nsh_telnetstart(sa_family_t family) if (state == TELNETD_NOTRUNNING) { +#if defined(CONFIG_NSH_ROMFSETC) && !defined(CONFIG_NSH_CONSOLE) + FAR struct console_stdio_s *pstate; +#endif struct telnetd_config_s config; /* There is a tiny race condition here if two tasks were to try to @@ -264,7 +267,9 @@ int nsh_telnetstart(sa_family_t family) */ #if defined(CONFIG_NSH_ROMFSETC) && !defined(CONFIG_NSH_CONSOLE) - nsh_initscript(vtbl); + pstate = nsh_newconsole(); + nsh_initscript(&pstate->cn_vtbl); + nsh_release(&pstate->cn_vtbl); #endif #if defined(CONFIG_NSH_NETINIT) && !defined(CONFIG_NSH_CONSOLE)