diff --git a/src/examples/rover_steering_control/main.cpp b/src/examples/rover_steering_control/main.cpp index 0afe0fc75d1448301c388a1431725fcd4a66da98..d72f1cd9cb2df9a86016ada7e17b13744f965a94 100644 --- a/src/examples/rover_steering_control/main.cpp +++ b/src/examples/rover_steering_control/main.cpp @@ -395,7 +395,6 @@ usage(const char *reason) } fprintf(stderr, "usage: rover_steering_control {start|stop|status}\n\n"); - exit(1); } /** @@ -410,6 +409,7 @@ int rover_steering_control_main(int argc, char *argv[]) { if (argc < 2) { usage("missing command"); + return 1; } if (!strcmp(argv[1], "start")) { @@ -417,7 +417,7 @@ int rover_steering_control_main(int argc, char *argv[]) if (thread_running) { warnx("running"); /* this is not an error */ - exit(0); + return 0; } thread_should_exit = false; @@ -428,12 +428,12 @@ int rover_steering_control_main(int argc, char *argv[]) rover_steering_control_thread_main, (argv) ? (char *const *)&argv[2] : (char *const *)nullptr); thread_running = true; - exit(0); + return 0; } if (!strcmp(argv[1], "stop")) { thread_should_exit = true; - exit(0); + return 0; } if (!strcmp(argv[1], "status")) { @@ -444,11 +444,11 @@ int rover_steering_control_main(int argc, char *argv[]) warnx("not started"); } - exit(0); + return 0; } usage("unrecognized command"); - exit(1); + return 1; }