mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-05-26 01:17:51 +08:00
rover_steering_control: avoid using exit()
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user