mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-05-23 06:36:45 +08:00
nsh: check nsh_consolemain return value
Starting a new console allocates memory dynamically, which can fail.
This commit is contained in:
committed by
Daniel Agar
parent
cde47e8fc0
commit
af40d5befd
Submodule platforms/nuttx/NuttX/apps updated: a489381b49...616f7024a4
@@ -186,7 +186,13 @@ int MavlinkShell::shell_start_thread(int argc, char *argv[])
|
||||
#ifdef __PX4_NUTTX
|
||||
dup2(1, 2); //redirect stderror to stdout
|
||||
|
||||
nsh_consolemain(0, NULL);
|
||||
const int ret = nsh_consolemain(0, NULL);
|
||||
|
||||
if (ret) {
|
||||
PX4_ERR("Mavlink shell failed: %d%s", ret, (ret == -ENOMEM) ? " (out of memory)" : "");
|
||||
return ret;
|
||||
}
|
||||
|
||||
#endif /* __PX4_NUTTX */
|
||||
|
||||
#ifdef __PX4_POSIX
|
||||
|
||||
Reference in New Issue
Block a user