From 8f5fb3d0e5f1fbce84d6b68a393162c5db24f4de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beat=20K=C3=BCng?= Date: Mon, 4 Jun 2018 14:28:52 +0200 Subject: [PATCH] bma180: add argc check --- src/drivers/imu/bma180/bma180.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/drivers/imu/bma180/bma180.cpp b/src/drivers/imu/bma180/bma180.cpp index 58431f46cd..6fd2bdb4aa 100644 --- a/src/drivers/imu/bma180/bma180.cpp +++ b/src/drivers/imu/bma180/bma180.cpp @@ -890,9 +890,12 @@ info() int bma180_main(int argc, char *argv[]) { + if (argc < 2) { + goto out_error; + } + /* * Start/load the driver. - */ if (!strcmp(argv[1], "start")) { bma180::start(); @@ -919,5 +922,6 @@ bma180_main(int argc, char *argv[]) bma180::info(); } +out_error: errx(1, "unrecognised command, try 'start', 'test', 'reset' or 'info'"); }