mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-04-14 10:07:39 +08:00
MuORB: handle case on no args passed
if only uorb is called with no other args it crashes. Handle the case where no args are passed. Signed-off-by: Mark Charlebois <charlebm@gmail.com>
This commit is contained in:
parent
cf71db74d7
commit
dffb8bb62c
@ -1021,6 +1021,11 @@ info()
|
||||
|
||||
} // namespace
|
||||
|
||||
static void usage()
|
||||
{
|
||||
warnx("Usage: uorb 'start', 'test', 'latency_test' or 'status'");
|
||||
}
|
||||
|
||||
/*
|
||||
* uORB server 'main'.
|
||||
*/
|
||||
@ -1029,6 +1034,11 @@ extern "C" { __EXPORT int uorb_main(int argc, char *argv[]); }
|
||||
int
|
||||
uorb_main(int argc, char *argv[])
|
||||
{
|
||||
if (argc < 2) {
|
||||
usage();
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
/*
|
||||
* Start/load the driver.
|
||||
*
|
||||
@ -1086,7 +1096,7 @@ uorb_main(int argc, char *argv[])
|
||||
if (!strcmp(argv[1], "status"))
|
||||
return info();
|
||||
|
||||
warnx("unrecognized command, try 'start', 'test', 'latency_test' or 'status'");
|
||||
usage();
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user