From 262d34174ea9a7bd46b7ffd12b70e9e1258fe063 Mon Sep 17 00:00:00 2001 From: "Robin.Mueller" Date: Sat, 6 Jun 2020 18:56:54 +0200 Subject: [PATCH] using strncat now --- osal/linux/PosixThread.cpp | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/osal/linux/PosixThread.cpp b/osal/linux/PosixThread.cpp index 3845123c..bc3e62ed 100644 --- a/osal/linux/PosixThread.cpp +++ b/osal/linux/PosixThread.cpp @@ -5,7 +5,8 @@ PosixThread::PosixThread(const char* name_, int priority_, size_t stackSize_): thread(0),priority(priority_),stackSize(stackSize_) { - strncpy(name, name_, PTHREAD_MAX_NAMELEN); + name[0] = '\0'; + std::strncat(name, name_, PTHREAD_MAX_NAMELEN - 1); } PosixThread::~PosixThread() { @@ -59,10 +60,6 @@ void PosixThread::resume(){ pthread_kill(thread,SIGUSR1); } - - - - bool PosixThread::delayUntil(uint64_t* const prevoiusWakeTime_ms, const uint64_t delayTime_ms) { uint64_t nextTimeToWake_ms; @@ -162,7 +159,7 @@ void PosixThread::createTask(void* (*fnc_)(void*), void* arg_) { strerror(status) << std::endl; } -//TODO FIFO -> This needs root privileges for the process + // TODO FIFO -> This needs root privileges for the process status = pthread_attr_setschedpolicy(&attributes,SCHED_FIFO); if(status != 0){ sif::error << "Posix Thread attribute schedule policy failed with: " << @@ -208,7 +205,6 @@ void PosixThread::createTask(void* (*fnc_)(void*), void* arg_) { " did not work.." << std::endl; } } - } status = pthread_attr_destroy(&attributes);