mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-11-03 03:41:35 +08:00
bma180: add argc check
This commit is contained in:
@@ -890,9 +890,12 @@ info()
|
|||||||
int
|
int
|
||||||
bma180_main(int argc, char *argv[])
|
bma180_main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
|
if (argc < 2) {
|
||||||
|
goto out_error;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Start/load the driver.
|
* Start/load the driver.
|
||||||
|
|
||||||
*/
|
*/
|
||||||
if (!strcmp(argv[1], "start")) {
|
if (!strcmp(argv[1], "start")) {
|
||||||
bma180::start();
|
bma180::start();
|
||||||
@@ -919,5 +922,6 @@ bma180_main(int argc, char *argv[])
|
|||||||
bma180::info();
|
bma180::info();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
out_error:
|
||||||
errx(1, "unrecognised command, try 'start', 'test', 'reset' or 'info'");
|
errx(1, "unrecognised command, try 'start', 'test', 'reset' or 'info'");
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user