Skip to content
Snippets Groups Projects
Commit 258f7a7f authored by Beat Küng's avatar Beat Küng
Browse files

fixedwing_control: avoid using exit()

parent d5bef4a9
No related branches found
No related tags found
No related merge requests found
...@@ -450,7 +450,6 @@ usage(const char *reason) ...@@ -450,7 +450,6 @@ usage(const char *reason)
} }
fprintf(stderr, "usage: ex_fixedwing_control {start|stop|status}\n\n"); fprintf(stderr, "usage: ex_fixedwing_control {start|stop|status}\n\n");
exit(1);
} }
/** /**
...@@ -465,6 +464,7 @@ int ex_fixedwing_control_main(int argc, char *argv[]) ...@@ -465,6 +464,7 @@ int ex_fixedwing_control_main(int argc, char *argv[])
{ {
if (argc < 2) { if (argc < 2) {
usage("missing command"); usage("missing command");
return 1;
} }
if (!strcmp(argv[1], "start")) { if (!strcmp(argv[1], "start")) {
...@@ -472,7 +472,7 @@ int ex_fixedwing_control_main(int argc, char *argv[]) ...@@ -472,7 +472,7 @@ int ex_fixedwing_control_main(int argc, char *argv[])
if (thread_running) { if (thread_running) {
printf("ex_fixedwing_control already running\n"); printf("ex_fixedwing_control already running\n");
/* this is not an error */ /* this is not an error */
exit(0); return 0;
} }
thread_should_exit = false; thread_should_exit = false;
...@@ -483,12 +483,12 @@ int ex_fixedwing_control_main(int argc, char *argv[]) ...@@ -483,12 +483,12 @@ int ex_fixedwing_control_main(int argc, char *argv[])
fixedwing_control_thread_main, fixedwing_control_thread_main,
(argv) ? (char *const *)&argv[2] : (char *const *)nullptr); (argv) ? (char *const *)&argv[2] : (char *const *)nullptr);
thread_running = true; thread_running = true;
exit(0); return 0;
} }
if (!strcmp(argv[1], "stop")) { if (!strcmp(argv[1], "stop")) {
thread_should_exit = true; thread_should_exit = true;
exit(0); return 0;
} }
if (!strcmp(argv[1], "status")) { if (!strcmp(argv[1], "status")) {
...@@ -499,9 +499,9 @@ int ex_fixedwing_control_main(int argc, char *argv[]) ...@@ -499,9 +499,9 @@ int ex_fixedwing_control_main(int argc, char *argv[])
printf("\tex_fixedwing_control not started\n"); printf("\tex_fixedwing_control not started\n");
} }
exit(0); return 0;
} }
usage("unrecognized command"); usage("unrecognized command");
exit(1); return 0;
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment