Skip to content
Snippets Groups Projects
Commit d29a2ecf authored by Mark Charlebois's avatar Mark Charlebois Committed by Julian Oes
Browse files

Set stack size to minimum valid size if less requested


The stack size cannot be less than PTHREAD_STACK_MIN.

Signed-off-by: default avatarMark Charlebois <charlebm@gmail.com>
parent e57d936d
No related branches found
No related tags found
No related merge requests found
......@@ -50,6 +50,7 @@
#include <unistd.h>
#include <string.h>
#include <pthread.h>
#include <limits.h>
#include <sys/stat.h>
#include <sys/types.h>
......@@ -172,10 +173,13 @@ px4_task_t px4_task_spawn_cmd(const char *name, int scheduler, int priority, int
return (rv < 0) ? rv : -rv;
}
if (stack_size < PTHREAD_STACK_MIN) {
stack_size = PTHREAD_STACK_MIN;
}
rv = pthread_attr_setstacksize(&attr, stack_size);
if (rv != 0) {
PX4_ERR("pthread_attr_setstacksize returned error");
PX4_ERR("pthread_attr_setstacksize to %d returned error (%d)", stack_size, rv);
return (rv < 0) ? rv : -rv;
}
......
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