aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Agar <daniel@agar.ca>2015-03-17 13:37:01 -0400
committerLorenz Meier <lm@inf.ethz.ch>2015-04-18 12:02:58 +0200
commit2e824bbeea8787a3166ce47cad90e622a3678b25 (patch)
tree6ad6fcbcdf36748fbd1dab6ed3f4b843ed403606
parent63d741e3686d4dd1fe872426aec0b1570f897628 (diff)
downloadpx4-firmware-2e824bbeea8787a3166ce47cad90e622a3678b25.tar.gz
px4-firmware-2e824bbeea8787a3166ce47cad90e622a3678b25.tar.bz2
px4-firmware-2e824bbeea8787a3166ce47cad90e622a3678b25.zip
fix incorrect argc < 1 check for no arguments
-requiring arguments should be argc < 2
-rw-r--r--src/drivers/ardrone_interface/ardrone_interface.c3
-rw-r--r--src/drivers/hott/hott_sensors/hott_sensors.cpp2
-rw-r--r--src/drivers/hott/hott_telemetry/hott_telemetry.cpp2
-rw-r--r--src/drivers/md25/md25_main.cpp3
-rw-r--r--src/drivers/roboclaw/roboclaw_main.cpp3
-rw-r--r--src/examples/fixedwing_control/main.c2
-rw-r--r--src/examples/flow_position_estimator/flow_position_estimator_main.c2
-rw-r--r--src/examples/matlab_csv_serial/matlab_csv_serial.c2
-rw-r--r--src/examples/publisher/publisher_start_nuttx.cpp2
-rw-r--r--src/examples/px4_daemon_app/px4_daemon_app.c2
-rw-r--r--src/examples/rover_steering_control/main.cpp2
-rw-r--r--src/examples/subscriber/subscriber_start_nuttx.cpp2
-rwxr-xr-xsrc/modules/attitude_estimator_ekf/attitude_estimator_ekf_main.cpp3
-rwxr-xr-xsrc/modules/attitude_estimator_so3/attitude_estimator_so3_main.cpp3
-rw-r--r--src/modules/commander/commander.cpp2
-rw-r--r--src/modules/ekf_att_pos_estimator/ekf_att_pos_estimator_main.cpp2
-rw-r--r--src/modules/fixedwing_backside/fixedwing_backside_main.cpp3
-rw-r--r--src/modules/fw_att_control/fw_att_control_main.cpp3
-rw-r--r--src/modules/fw_pos_control_l1/fw_pos_control_l1_main.cpp3
-rw-r--r--src/modules/land_detector/land_detector_main.cpp2
-rw-r--r--src/modules/mc_att_control/mc_att_control_main.cpp3
-rw-r--r--src/modules/mc_att_control_multiplatform/mc_att_control_start_nuttx.cpp2
-rw-r--r--src/modules/mc_pos_control/mc_pos_control_main.cpp2
-rw-r--r--src/modules/mc_pos_control_multiplatform/mc_pos_control_start_nuttx.cpp2
-rw-r--r--src/modules/position_estimator_inav/position_estimator_inav_main.c2
-rw-r--r--src/modules/segway/segway_main.cpp3
-rw-r--r--src/modules/sensors/sensors.cpp2
-rw-r--r--src/modules/vtol_att_control/vtol_att_control_main.cpp2
28 files changed, 38 insertions, 28 deletions
diff --git a/src/drivers/ardrone_interface/ardrone_interface.c b/src/drivers/ardrone_interface/ardrone_interface.c
index 7d4b7d880..53d98ba9a 100644
--- a/src/drivers/ardrone_interface/ardrone_interface.c
+++ b/src/drivers/ardrone_interface/ardrone_interface.c
@@ -108,8 +108,9 @@ usage(const char *reason)
*/
int ardrone_interface_main(int argc, char *argv[])
{
- if (argc < 1)
+ if (argc < 2) {
usage("missing command");
+ }
if (!strcmp(argv[1], "start")) {
diff --git a/src/drivers/hott/hott_sensors/hott_sensors.cpp b/src/drivers/hott/hott_sensors/hott_sensors.cpp
index 1aade450b..4ac7e4bdf 100644
--- a/src/drivers/hott/hott_sensors/hott_sensors.cpp
+++ b/src/drivers/hott/hott_sensors/hott_sensors.cpp
@@ -197,7 +197,7 @@ hott_sensors_thread_main(int argc, char *argv[])
int
hott_sensors_main(int argc, char *argv[])
{
- if (argc < 1) {
+ if (argc < 2) {
errx(1, "missing command\n%s", commandline_usage);
}
diff --git a/src/drivers/hott/hott_telemetry/hott_telemetry.cpp b/src/drivers/hott/hott_telemetry/hott_telemetry.cpp
index 17a24d104..43df0cb8c 100644
--- a/src/drivers/hott/hott_telemetry/hott_telemetry.cpp
+++ b/src/drivers/hott/hott_telemetry/hott_telemetry.cpp
@@ -223,7 +223,7 @@ hott_telemetry_thread_main(int argc, char *argv[])
int
hott_telemetry_main(int argc, char *argv[])
{
- if (argc < 1) {
+ if (argc < 2) {
errx(1, "missing command\n%s", commandline_usage);
}
diff --git a/src/drivers/md25/md25_main.cpp b/src/drivers/md25/md25_main.cpp
index 7e5904d05..d25d16fa1 100644
--- a/src/drivers/md25/md25_main.cpp
+++ b/src/drivers/md25/md25_main.cpp
@@ -97,8 +97,9 @@ usage(const char *reason)
int md25_main(int argc, char *argv[])
{
- if (argc < 1)
+ if (argc < 2) {
usage("missing command");
+ }
if (!strcmp(argv[1], "start")) {
diff --git a/src/drivers/roboclaw/roboclaw_main.cpp b/src/drivers/roboclaw/roboclaw_main.cpp
index 83086fd7c..ea7178076 100644
--- a/src/drivers/roboclaw/roboclaw_main.cpp
+++ b/src/drivers/roboclaw/roboclaw_main.cpp
@@ -92,8 +92,9 @@ static void usage()
int roboclaw_main(int argc, char *argv[])
{
- if (argc < 1)
+ if (argc < 2) {
usage();
+ }
if (!strcmp(argv[1], "start")) {
diff --git a/src/examples/fixedwing_control/main.c b/src/examples/fixedwing_control/main.c
index 17b27290c..1d590ae61 100644
--- a/src/examples/fixedwing_control/main.c
+++ b/src/examples/fixedwing_control/main.c
@@ -418,7 +418,7 @@ usage(const char *reason)
*/
int ex_fixedwing_control_main(int argc, char *argv[])
{
- if (argc < 1) {
+ if (argc < 2) {
usage("missing command");
}
diff --git a/src/examples/flow_position_estimator/flow_position_estimator_main.c b/src/examples/flow_position_estimator/flow_position_estimator_main.c
index f8e3f2dc5..ab67bd253 100644
--- a/src/examples/flow_position_estimator/flow_position_estimator_main.c
+++ b/src/examples/flow_position_estimator/flow_position_estimator_main.c
@@ -99,7 +99,7 @@ static void usage(const char *reason)
*/
int flow_position_estimator_main(int argc, char *argv[])
{
- if (argc < 1) {
+ if (argc < 2) {
usage("missing command");
}
diff --git a/src/examples/matlab_csv_serial/matlab_csv_serial.c b/src/examples/matlab_csv_serial/matlab_csv_serial.c
index 8e439bdac..085ef1fed 100644
--- a/src/examples/matlab_csv_serial/matlab_csv_serial.c
+++ b/src/examples/matlab_csv_serial/matlab_csv_serial.c
@@ -91,7 +91,7 @@ static void usage(const char *reason)
*/
int matlab_csv_serial_main(int argc, char *argv[])
{
- if (argc < 1) {
+ if (argc < 2) {
usage("missing command");
}
diff --git a/src/examples/publisher/publisher_start_nuttx.cpp b/src/examples/publisher/publisher_start_nuttx.cpp
index 405b3c987..4ff2cebfb 100644
--- a/src/examples/publisher/publisher_start_nuttx.cpp
+++ b/src/examples/publisher/publisher_start_nuttx.cpp
@@ -54,7 +54,7 @@ extern int main(int argc, char **argv);
extern "C" __EXPORT int publisher_main(int argc, char *argv[]);
int publisher_main(int argc, char *argv[])
{
- if (argc < 1) {
+ if (argc < 2) {
errx(1, "usage: publisher {start|stop|status}");
}
diff --git a/src/examples/px4_daemon_app/px4_daemon_app.c b/src/examples/px4_daemon_app/px4_daemon_app.c
index 860b1af78..6e99939d1 100644
--- a/src/examples/px4_daemon_app/px4_daemon_app.c
+++ b/src/examples/px4_daemon_app/px4_daemon_app.c
@@ -88,7 +88,7 @@ usage(const char *reason)
*/
int px4_daemon_app_main(int argc, char *argv[])
{
- if (argc < 1) {
+ if (argc < 2) {
usage("missing command");
}
diff --git a/src/examples/rover_steering_control/main.cpp b/src/examples/rover_steering_control/main.cpp
index 96b40b23f..41df96775 100644
--- a/src/examples/rover_steering_control/main.cpp
+++ b/src/examples/rover_steering_control/main.cpp
@@ -412,7 +412,7 @@ usage(const char *reason)
*/
int rover_steering_control_main(int argc, char *argv[])
{
- if (argc < 1) {
+ if (argc < 2) {
usage("missing command");
}
diff --git a/src/examples/subscriber/subscriber_start_nuttx.cpp b/src/examples/subscriber/subscriber_start_nuttx.cpp
index b450230c1..757e8ec52 100644
--- a/src/examples/subscriber/subscriber_start_nuttx.cpp
+++ b/src/examples/subscriber/subscriber_start_nuttx.cpp
@@ -54,7 +54,7 @@ extern int main(int argc, char **argv);
extern "C" __EXPORT int subscriber_main(int argc, char *argv[]);
int subscriber_main(int argc, char *argv[])
{
- if (argc < 1) {
+ if (argc < 2) {
errx(1, "usage: subscriber {start|stop|status}");
}
diff --git a/src/modules/attitude_estimator_ekf/attitude_estimator_ekf_main.cpp b/src/modules/attitude_estimator_ekf/attitude_estimator_ekf_main.cpp
index c60d70b9f..9bb9393c5 100755
--- a/src/modules/attitude_estimator_ekf/attitude_estimator_ekf_main.cpp
+++ b/src/modules/attitude_estimator_ekf/attitude_estimator_ekf_main.cpp
@@ -118,8 +118,9 @@ usage(const char *reason)
*/
int attitude_estimator_ekf_main(int argc, char *argv[])
{
- if (argc < 1)
+ if (argc < 2) {
usage("missing command");
+ }
if (!strcmp(argv[1], "start")) {
diff --git a/src/modules/attitude_estimator_so3/attitude_estimator_so3_main.cpp b/src/modules/attitude_estimator_so3/attitude_estimator_so3_main.cpp
index 9414225ca..82bcbc66f 100755
--- a/src/modules/attitude_estimator_so3/attitude_estimator_so3_main.cpp
+++ b/src/modules/attitude_estimator_so3/attitude_estimator_so3_main.cpp
@@ -136,8 +136,9 @@ usage(const char *reason)
*/
int attitude_estimator_so3_main(int argc, char *argv[])
{
- if (argc < 1)
+ if (argc < 2) {
usage("missing command");
+ }
if (!strcmp(argv[1], "start")) {
diff --git a/src/modules/commander/commander.cpp b/src/modules/commander/commander.cpp
index 453d5f921..2722766b0 100644
--- a/src/modules/commander/commander.cpp
+++ b/src/modules/commander/commander.cpp
@@ -261,7 +261,7 @@ void answer_command(struct vehicle_command_s &cmd, enum VEHICLE_CMD_RESULT resul
int commander_main(int argc, char *argv[])
{
- if (argc < 1) {
+ if (argc < 2) {
usage("missing command");
}
diff --git a/src/modules/ekf_att_pos_estimator/ekf_att_pos_estimator_main.cpp b/src/modules/ekf_att_pos_estimator/ekf_att_pos_estimator_main.cpp
index c16e72ea0..33289dacb 100644
--- a/src/modules/ekf_att_pos_estimator/ekf_att_pos_estimator_main.cpp
+++ b/src/modules/ekf_att_pos_estimator/ekf_att_pos_estimator_main.cpp
@@ -1516,7 +1516,7 @@ int AttitudePositionEstimatorEKF::trip_nan()
int ekf_att_pos_estimator_main(int argc, char *argv[])
{
- if (argc < 1) {
+ if (argc < 2) {
errx(1, "usage: ekf_att_pos_estimator {start|stop|status|logging}");
}
diff --git a/src/modules/fixedwing_backside/fixedwing_backside_main.cpp b/src/modules/fixedwing_backside/fixedwing_backside_main.cpp
index 71b387b1e..bd1486324 100644
--- a/src/modules/fixedwing_backside/fixedwing_backside_main.cpp
+++ b/src/modules/fixedwing_backside/fixedwing_backside_main.cpp
@@ -97,8 +97,9 @@ usage(const char *reason)
int fixedwing_backside_main(int argc, char *argv[])
{
- if (argc < 1)
+ if (argc < 2) {
usage("missing command");
+ }
if (!strcmp(argv[1], "start")) {
diff --git a/src/modules/fw_att_control/fw_att_control_main.cpp b/src/modules/fw_att_control/fw_att_control_main.cpp
index 8b41144f6..0a8d07fed 100644
--- a/src/modules/fw_att_control/fw_att_control_main.cpp
+++ b/src/modules/fw_att_control/fw_att_control_main.cpp
@@ -1134,8 +1134,9 @@ FixedwingAttitudeControl::start()
int fw_att_control_main(int argc, char *argv[])
{
- if (argc < 1)
+ if (argc < 2) {
errx(1, "usage: fw_att_control {start|stop|status}");
+ }
if (!strcmp(argv[1], "start")) {
diff --git a/src/modules/fw_pos_control_l1/fw_pos_control_l1_main.cpp b/src/modules/fw_pos_control_l1/fw_pos_control_l1_main.cpp
index 427df9739..34265d6a4 100644
--- a/src/modules/fw_pos_control_l1/fw_pos_control_l1_main.cpp
+++ b/src/modules/fw_pos_control_l1/fw_pos_control_l1_main.cpp
@@ -1638,8 +1638,9 @@ FixedwingPositionControl::start()
int fw_pos_control_l1_main(int argc, char *argv[])
{
- if (argc < 1)
+ if (argc < 2) {
errx(1, "usage: fw_pos_control_l1 {start|stop|status}");
+ }
if (!strcmp(argv[1], "start")) {
diff --git a/src/modules/land_detector/land_detector_main.cpp b/src/modules/land_detector/land_detector_main.cpp
index 011567e57..b4b7c33a2 100644
--- a/src/modules/land_detector/land_detector_main.cpp
+++ b/src/modules/land_detector/land_detector_main.cpp
@@ -178,7 +178,7 @@ static int land_detector_start(const char *mode)
int land_detector_main(int argc, char *argv[])
{
- if (argc < 1) {
+ if (argc < 2) {
goto exiterr;
}
diff --git a/src/modules/mc_att_control/mc_att_control_main.cpp b/src/modules/mc_att_control/mc_att_control_main.cpp
index b8c143782..3a0dfe4c3 100644
--- a/src/modules/mc_att_control/mc_att_control_main.cpp
+++ b/src/modules/mc_att_control/mc_att_control_main.cpp
@@ -922,8 +922,9 @@ MulticopterAttitudeControl::start()
int mc_att_control_main(int argc, char *argv[])
{
- if (argc < 1)
+ if (argc < 2) {
errx(1, "usage: mc_att_control {start|stop|status}");
+ }
if (!strcmp(argv[1], "start")) {
diff --git a/src/modules/mc_att_control_multiplatform/mc_att_control_start_nuttx.cpp b/src/modules/mc_att_control_multiplatform/mc_att_control_start_nuttx.cpp
index 40eb498b4..dec1e1745 100644
--- a/src/modules/mc_att_control_multiplatform/mc_att_control_start_nuttx.cpp
+++ b/src/modules/mc_att_control_multiplatform/mc_att_control_start_nuttx.cpp
@@ -54,7 +54,7 @@ extern int main(int argc, char **argv);
extern "C" __EXPORT int mc_att_control_m_main(int argc, char *argv[]);
int mc_att_control_m_main(int argc, char *argv[])
{
- if (argc < 1) {
+ if (argc < 2) {
errx(1, "usage: mc_att_control_m {start|stop|status}");
}
diff --git a/src/modules/mc_pos_control/mc_pos_control_main.cpp b/src/modules/mc_pos_control/mc_pos_control_main.cpp
index 4910454bd..5191a4de3 100644
--- a/src/modules/mc_pos_control/mc_pos_control_main.cpp
+++ b/src/modules/mc_pos_control/mc_pos_control_main.cpp
@@ -1440,7 +1440,7 @@ MulticopterPositionControl::start()
int mc_pos_control_main(int argc, char *argv[])
{
- if (argc < 1) {
+ if (argc < 2) {
errx(1, "usage: mc_pos_control {start|stop|status}");
}
diff --git a/src/modules/mc_pos_control_multiplatform/mc_pos_control_start_nuttx.cpp b/src/modules/mc_pos_control_multiplatform/mc_pos_control_start_nuttx.cpp
index 1082061f6..0db67d83f 100644
--- a/src/modules/mc_pos_control_multiplatform/mc_pos_control_start_nuttx.cpp
+++ b/src/modules/mc_pos_control_multiplatform/mc_pos_control_start_nuttx.cpp
@@ -54,7 +54,7 @@ extern int main(int argc, char **argv);
extern "C" __EXPORT int mc_pos_control_m_main(int argc, char *argv[]);
int mc_pos_control_m_main(int argc, char *argv[])
{
- if (argc < 1) {
+ if (argc < 2) {
errx(1, "usage: mc_pos_control_m {start|stop|status}");
}
diff --git a/src/modules/position_estimator_inav/position_estimator_inav_main.c b/src/modules/position_estimator_inav/position_estimator_inav_main.c
index ec297e7f0..437395b1f 100644
--- a/src/modules/position_estimator_inav/position_estimator_inav_main.c
+++ b/src/modules/position_estimator_inav/position_estimator_inav_main.c
@@ -134,7 +134,7 @@ static void usage(const char *reason)
*/
int position_estimator_inav_main(int argc, char *argv[])
{
- if (argc < 1) {
+ if (argc < 2) {
usage("missing command");
}
diff --git a/src/modules/segway/segway_main.cpp b/src/modules/segway/segway_main.cpp
index ee492f85a..b36d56d6d 100644
--- a/src/modules/segway/segway_main.cpp
+++ b/src/modules/segway/segway_main.cpp
@@ -92,8 +92,9 @@ usage(const char *reason)
int segway_main(int argc, char *argv[])
{
- if (argc < 1)
+ if (argc < 2) {
usage("missing command");
+ }
if (!strcmp(argv[1], "start")) {
diff --git a/src/modules/sensors/sensors.cpp b/src/modules/sensors/sensors.cpp
index 259361be6..d4692ea7d 100644
--- a/src/modules/sensors/sensors.cpp
+++ b/src/modules/sensors/sensors.cpp
@@ -2252,7 +2252,7 @@ Sensors::start()
int sensors_main(int argc, char *argv[])
{
- if (argc < 1) {
+ if (argc < 2) {
errx(1, "usage: sensors {start|stop|status}");
}
diff --git a/src/modules/vtol_att_control/vtol_att_control_main.cpp b/src/modules/vtol_att_control/vtol_att_control_main.cpp
index 74e1efd6c..defcff8e4 100644
--- a/src/modules/vtol_att_control/vtol_att_control_main.cpp
+++ b/src/modules/vtol_att_control/vtol_att_control_main.cpp
@@ -877,7 +877,7 @@ VtolAttitudeControl::start()
int vtol_att_control_main(int argc, char *argv[])
{
- if (argc < 1) {
+ if (argc < 2) {
errx(1, "usage: vtol_att_control {start|stop|status}");
}