Skip to content

Commit

Permalink
dataman: fix test for return value of px4_task_spawn_cmd
Browse files Browse the repository at this point in the history
And destroy the semaphore if startup fails.

Credits for finding this go to @jeonghwan-lee
  • Loading branch information
bkueng authored and LorenzMeier committed Sep 11, 2017
1 parent 694de32 commit c82deaf
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/modules/dataman/dataman.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1453,8 +1453,9 @@ start()
px4_sem_setprotocol(&g_init_sema, SEM_PRIO_NONE);

/* start the worker thread with low priority for disk IO */
if ((task = px4_task_spawn_cmd("dataman", SCHED_DEFAULT, SCHED_PRIORITY_DEFAULT - 10, 1200, task_main, nullptr)) <= 0) {
warn("task start failed");
if ((task = px4_task_spawn_cmd("dataman", SCHED_DEFAULT, SCHED_PRIORITY_DEFAULT - 10, 1200, task_main, nullptr)) < 0) {
px4_sem_destroy(&g_init_sema);
PX4_ERR("task start failed");
return -1;
}

Expand Down

0 comments on commit c82deaf

Please sign in to comment.