diff --git a/src/examples/fixedwing_control/main.cpp b/src/examples/fixedwing_control/main.cpp
index 628b201c6c6d227e66fe1c3564873d555bad7b6a..8589c26629b315ea7e1e152a482b7ba05696901f 100644
--- a/src/examples/fixedwing_control/main.cpp
+++ b/src/examples/fixedwing_control/main.cpp
@@ -450,7 +450,6 @@ usage(const char *reason)
 	}
 
 	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[])
 {
 	if (argc < 2) {
 		usage("missing command");
+		return 1;
 	}
 
 	if (!strcmp(argv[1], "start")) {
@@ -472,7 +472,7 @@ int ex_fixedwing_control_main(int argc, char *argv[])
 		if (thread_running) {
 			printf("ex_fixedwing_control already running\n");
 			/* this is not an error */
-			exit(0);
+			return 0;
 		}
 
 		thread_should_exit = false;
@@ -483,12 +483,12 @@ int ex_fixedwing_control_main(int argc, char *argv[])
 						 fixedwing_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")) {
@@ -499,9 +499,9 @@ int ex_fixedwing_control_main(int argc, char *argv[])
 			printf("\tex_fixedwing_control not started\n");
 		}
 
-		exit(0);
+		return 0;
 	}
 
 	usage("unrecognized command");
-	exit(1);
+	return 0;
 }