Index: trunk/ReleaseNotes
===================================================================
--- trunk/ReleaseNotes	(revision 132)
+++ trunk/ReleaseNotes	(revision 133)
@@ -7,4 +7,5 @@
 See also https://devel.hds.utc.fr/software/flair/wiki/hds_users
 - added demos/OpticalFlow: stabilization using optical flow (vertical camera)
+- resolved https://devel.hds.utc.fr/software/flair/ticket/8
 - Uav class is now a singleton
 - VrpnClient class is now a singleton
Index: trunk/lib/FlairCore/src/ConditionVariable_impl.cpp
===================================================================
--- trunk/lib/FlairCore/src/ConditionVariable_impl.cpp	(revision 132)
+++ trunk/lib/FlairCore/src/ConditionVariable_impl.cpp	(revision 133)
@@ -33,6 +33,8 @@
   status = pthread_cond_init(&m_ResumeCond, 0);
 #endif
-  if (status != 0)
-    self->Err("error creating condition variable (%s)\n", strerror(-status));
+  if (status != 0) {
+		char errorMsg[256];
+    self->Err("error creating condition variable (%s)\n", strerror_r(-status, errorMsg, sizeof(errorMsg)));
+	}
 }
 
@@ -45,6 +47,8 @@
   status = pthread_cond_destroy(&m_ResumeCond);
 #endif
-  if (status != 0)
-    self->Err("error destroying condition variable (%s)\n", strerror(-status));
+  if (status != 0) {
+		char errorMsg[256];
+    self->Err("error destroying condition variable (%s)\n", strerror_r(-status, errorMsg, sizeof(errorMsg)));
+	}
 }
 
@@ -57,6 +61,8 @@
   status = pthread_cond_wait(&m_ResumeCond, &self->Mutex::pimpl_->mutex);
 #endif
-  if (status != 0)
-    self->Err("error (%s)\n", strerror(-status));
+  if (status != 0) {
+		char errorMsg[256];
+    self->Err("error (%s)\n", strerror_r(-status, errorMsg, sizeof(errorMsg)));
+	}
 }
 
@@ -74,6 +80,8 @@
   if (status == 0)
     return true;
-  if (status != ETIMEDOUT)
-    self->Err("error (%s)\n", strerror(-status));
+  if (status != ETIMEDOUT) {
+		char errorMsg[256];
+    self->Err("error (%s)\n", strerror_r(-status, errorMsg, sizeof(errorMsg)));
+	}
   return false;
 }
@@ -86,5 +94,7 @@
   status = pthread_cond_signal(&m_ResumeCond);
 #endif
-  if (status != 0)
-    self->Err("error (%s)\n", strerror(-status));
+	if (status != 0) {
+		char errorMsg[256];
+    self->Err("error (%s)\n", strerror_r(-status, errorMsg, sizeof(errorMsg)));
+	}
 }
Index: trunk/lib/FlairCore/src/FrameworkManager_impl.cpp
===================================================================
--- trunk/lib/FlairCore/src/FrameworkManager_impl.cpp	(revision 132)
+++ trunk/lib/FlairCore/src/FrameworkManager_impl.cpp	(revision 133)
@@ -132,5 +132,6 @@
   int status = rt_task_shadow(NULL, task_name.c_str(), 10, 0);
   if (status != 0) {
-    self->Err("rt_task_shadow error (%s)\n", strerror(-status));
+		char errorMsg[256];
+    self->Err("rt_task_shadow error (%s)\n", strerror_r(-status, errorMsg, sizeof(errorMsg)));
   }
 
@@ -147,5 +148,6 @@
   // Printf("destruction FrameworkManager_impl\n");
   int status;
-
+	char errorMsg[256];
+	
   SafeStop();
   Join();
@@ -160,9 +162,9 @@
     status = DeletePipe(&cmd_pipe);
     if (status != 0) {
-      Err("Error deleting pipe (%s)\n", strerror(-status));
+      Err("Error deleting pipe (%s)\n", strerror_r(-status, errorMsg, sizeof(errorMsg)));
     }
     status = DeletePipe(&data_pipe);
     if (status != 0) {
-      Err("Error deleting pipe (%s)\n", strerror(-status));
+      Err("Error deleting pipe (%s)\n", strerror_r(-status, errorMsg, sizeof(errorMsg)));
     }
 
@@ -170,5 +172,5 @@
     status = rt_heap_delete(&log_heap);
     if (status != 0) {
-      Err("rt_heap_delete error (%s)\n", strerror(-status));
+      Err("rt_heap_delete error (%s)\n", strerror_r(-status, errorMsg, sizeof(errorMsg)));
     }
 #endif
@@ -561,5 +563,7 @@
 
 void FrameworkManager_impl::SetupLogger(string log_path) {
-  if (logger_defined == true) {
+  char errorMsg[256];
+	
+	if (logger_defined == true) {
     Warn("SetupLogger() was already called.\n");
     return;
@@ -570,5 +574,5 @@
   int status = CreatePipe(&cmd_pipe, "log_cmd");
   if (status != 0) {
-    Err("Error creating pipe (%s)\n", strerror(-status));
+    Err("Error creating pipe (%s)\n", strerror_r(-status, errorMsg, sizeof(errorMsg)));
     return;
   }
@@ -576,5 +580,5 @@
   status = CreatePipe(&data_pipe, "log_data");
   if (status != 0) {
-    Err("Error creating pipe (%s)\n", strerror(-status));
+    Err("Error creating pipe (%s)\n", strerror_r(-status, errorMsg, sizeof(errorMsg)));
     return;
   }
@@ -585,5 +589,5 @@
   status = rt_heap_create(&log_heap, tmp_name.c_str(), LOG_HEAP, H_FIFO);
   if (status != 0) {
-    Err("rt_heap_create error (%s)\n", strerror(-status));
+    Err("rt_heap_create error (%s)\n", strerror_r(-status, errorMsg, sizeof(errorMsg)));
     return;
   }
@@ -675,5 +679,6 @@
 
       if (written < 0) {
-        Err("write pipe error (%s)\n", strerror(-written));
+				char errorMsg[256];
+        Err("write pipe error (%s)\n", strerror_r(-written, errorMsg, sizeof(errorMsg)));
         nb_err++;
         logs.at(i).running = false;
@@ -708,5 +713,6 @@
 
     if (written < 0) {
-      Err("write pipe error (%s)\n", strerror(-written));
+			char errorMsg[256];
+      Err("write pipe error (%s)\n", strerror_r(-written, errorMsg, sizeof(errorMsg)));
       return;
     } else if (written != sizeof(log_desc_t)) {
@@ -727,5 +733,6 @@
   int status = rt_heap_alloc(&log_heap, sz, TM_NONBLOCK, &ptr);
   if (status != 0) {
-    Err("rt_heap_alloc error (%s)\n", strerror(-status));
+		char errorMsg[256];
+    Err("rt_heap_alloc error (%s)\n", strerror_r(-status, errorMsg, sizeof(errorMsg)));
     ptr = NULL;
   }
@@ -741,5 +748,6 @@
 
   if (status != 0) {
-    Err("rt_heap_free error (%s)\n", strerror(-status));
+		char errorMsg[256];
+    Err("rt_heap_free error (%s)\n", strerror_r(-status, errorMsg, sizeof(errorMsg)));
   }
 #else
@@ -758,7 +766,8 @@
 
   if (written < 0) {
-    Err("erreur write pipe (%s)\n", strerror(-written));
+		char errorMsg[256];
+    Err("error write pipe (%s)\n", strerror_r(-written, errorMsg, sizeof(errorMsg)));
   } else if (written != (ssize_t)size) {
-    Err("erreur write pipe %ld/%ld\n", written, size);
+    Err("error write pipe %ld/%ld\n", written, size);
   }
 }
@@ -776,9 +785,10 @@
 
 #ifdef __XENO__
+	char errorMsg[256];
   filename = NRT_PIPE_PATH + caller->self->ObjectName() + "-log_cmd";
   while (cmd_pipe < 0) {
     cmd_pipe = open(filename.c_str(), O_RDWR);
     if (cmd_pipe < 0 && errno != ENOENT)
-      caller->self->Err("open rt_pipe error: %s %i\n", filename.c_str(), errno);
+      caller->self->Err("open rt_pipe error: %s %s\n", filename.c_str(), strerror_r(errno, errorMsg, sizeof(errorMsg)));
     usleep(1000);
   }
@@ -787,5 +797,5 @@
     data_pipe = open(filename.c_str(), O_RDWR);
     if (data_pipe < 0 && errno != ENOENT)
-      caller->self->Err("open rt_pipe error: %s %i\n", filename.c_str(), errno);
+      caller->self->Err("open rt_pipe error: %s %s\n", filename.c_str(), strerror_r(errno, errorMsg, sizeof(errorMsg)));
     usleep(1000);
   }
Index: trunk/lib/FlairCore/src/Mutex_impl.cpp
===================================================================
--- trunk/lib/FlairCore/src/Mutex_impl.cpp	(revision 132)
+++ trunk/lib/FlairCore/src/Mutex_impl.cpp	(revision 133)
@@ -27,6 +27,8 @@
 #ifdef __XENO__
   int status = rt_mutex_create(&mutex, NULL);
-  if (status != 0)
-    self->Err("rt_mutex_create error (%s)\n", strerror(-status));
+  if (status != 0) {
+		char errorMsg[256];
+    self->Err("rt_mutex_create error (%s)\n", strerror_r(-status, errorMsg, sizeof(errorMsg)));
+	}
 #else
   // flag_locked=false;//revoir l'implementation nrt du is_locked
@@ -49,4 +51,6 @@
 Mutex_impl::~Mutex_impl() {
   int status;
+	char errorMsg[256];
+	
 #ifdef __XENO__
   status = rt_mutex_delete(&mutex);
@@ -55,9 +59,11 @@
 #endif
   if (status != 0)
-    self->Err("error destroying mutex (%s)\n", strerror(-status));
+    self->Err("error destroying mutex (%s)\n", strerror_r(-status, errorMsg, sizeof(errorMsg)));
 }
 
 void Mutex_impl::GetMutex(void) {
   int status;
+	char errorMsg[256];
+	
 #ifdef __XENO__
   status = rt_mutex_acquire(&mutex, TM_INFINITE);
@@ -67,9 +73,10 @@
 #endif
   if (status != 0)
-    self->Err("error (%s)\n", strerror(-status));
+    self->Err("error (%s)\n", strerror_r(-status, errorMsg, sizeof(errorMsg)));
 }
 
 void Mutex_impl::ReleaseMutex(void) {
   int status;
+	
 #ifdef __XENO__
   status = rt_mutex_release(&mutex);
@@ -78,6 +85,8 @@
 // flag_locked=false;
 #endif
-  if (status != 0)
-    self->Err("error (%s)\n", strerror(-status));
+  if (status != 0) {
+		char errorMsg[256];
+    self->Err("error (%s)\n", strerror_r(-status, errorMsg, sizeof(errorMsg)));
+	}
 }
 
@@ -88,6 +97,5 @@
     RT_MUTEX_INFO info;
     int status=rt_mutex_inquire(&mutex_rt,&info);
-    if(status!=0) mutex->Err("erreur rt_mutex_inquire
-(%s)\n",strerror(-status));
+    if(status!=0) mutex->Err("erreur rt_mutex_inquire (%s)\n",strerror_r(-status, errorMsg, sizeof(errorMsg)));
     if(info.locked>0) return true;
     return false;
Index: trunk/lib/FlairCore/src/RTDM_I2cPort.cpp
===================================================================
--- trunk/lib/FlairCore/src/RTDM_I2cPort.cpp	(revision 132)
+++ trunk/lib/FlairCore/src/RTDM_I2cPort.cpp	(revision 133)
@@ -21,5 +21,4 @@
 
 #include <rtdm/rti2c.h>
-#include <errno.h>
 #include <cstring>
 
@@ -37,5 +36,6 @@
   fd = rt_dev_open(device.c_str(), 0);
   if (fd < 0) {
-    Err("rt_dev_open (%s)\n", ObjectName().c_str(), strerror(-fd));
+		char errorMsg[256];
+    Err("rt_dev_open (%s)\n", ObjectName().c_str(), strerror_r(-fd, errorMsg, sizeof(errorMsg)));
   }
 
@@ -50,6 +50,7 @@
   err = rt_dev_ioctl(fd, RTI2C_RTIOC_SET_CONFIG, &write_config);
   if (err) {
+		char errorMsg[256];
     Err("rt_dev_ioctl RTI2C_RTIOC_SET_CONFIG error (%s)\n",
-        ObjectName().c_str(), strerror(-err));
+        ObjectName().c_str(), strerror_r(-err, errorMsg, sizeof(errorMsg)));
   }
 }
@@ -60,5 +61,6 @@
   int err = rt_dev_ioctl(fd, RTI2C_RTIOC_SET_SLAVE, &address);
   if (err) {
-    Err("rt_dev_ioctl RTI2C_RTIOC_SET_SLAVE error (%s)\n", strerror(-err));
+		char errorMsg[256];
+    Err("rt_dev_ioctl RTI2C_RTIOC_SET_SLAVE error (%s)\n", strerror_r(-err, errorMsg, sizeof(errorMsg)));
   }
 
@@ -74,6 +76,7 @@
   int err = rt_dev_ioctl(fd, RTI2C_RTIOC_SET_CONFIG, &write_config);
   if (err) {
+		char errorMsg[256];
     Err("rt_dev_ioctl RTI2C_RTIOC_SET_CONFIG (%s)\n", ObjectName().c_str(),
-        strerror(-err));
+        strerror_r(-err, errorMsg, sizeof(errorMsg)));
   }
 }
@@ -87,6 +90,7 @@
   int err = rt_dev_ioctl(fd, RTI2C_RTIOC_SET_CONFIG, &write_config);
   if (err) {
+		char errorMsg[256];
     Err("rt_dev_ioctl RTI2C_RTIOC_SET_CONFIG (%s)\n", ObjectName().c_str(),
-        strerror(-err));
+        strerror_r(-err, errorMsg, sizeof(errorMsg)));
   }
 }
Index: trunk/lib/FlairCore/src/RTDM_SerialPort.cpp
===================================================================
--- trunk/lib/FlairCore/src/RTDM_SerialPort.cpp	(revision 132)
+++ trunk/lib/FlairCore/src/RTDM_SerialPort.cpp	(revision 133)
@@ -21,5 +21,4 @@
 
 #include <rtdm/rtserial.h>
-#include <errno.h>
 #include <cstring>
 
@@ -41,5 +40,6 @@
       fd = rt_dev_open(device.c_str(), 0);
   if (fd < 0) {
-    Err("erreur rt_dev_open (%s)\n", strerror(-fd));
+		char errorMsg[256];
+    Err("error rt_dev_open (%s)\n", strerror_r(-fd, errorMsg, sizeof(errorMsg)));
   }
 
@@ -47,5 +47,6 @@
   int err = rt_dev_ioctl(fd, RTSER_RTIOC_SET_CONFIG, &write_config);
   if (err) {
-    Err("erreur rt_dev_ioctl RTSER_RTIOC_SET_CONFIG (%s)\n", strerror(-err));
+		char errorMsg[256];
+    Err("error rt_dev_ioctl RTSER_RTIOC_SET_CONFIG (%s)\n", strerror_r(-err, errorMsg, sizeof(errorMsg)));
   }
 }
@@ -63,5 +64,6 @@
   int err = rt_dev_ioctl(fd, RTSER_RTIOC_SET_CONFIG, &write_config);
   if (err) {
-    Err("erreur rt_dev_ioctl RTSER_RTIOC_SET_CONFIG (%s)\n", strerror(-err));
+		char errorMsg[256];
+    Err("error rt_dev_ioctl RTSER_RTIOC_SET_CONFIG (%s)\n", strerror_r(-err, errorMsg, sizeof(errorMsg)));
   }
 }
@@ -77,5 +79,6 @@
   int err = rt_dev_ioctl(fd, RTSER_RTIOC_SET_CONFIG, &write_config);
   if (err) {
-    Err("erreur rt_dev_ioctl RTSER_RTIOC_SET_CONFIG (%s)\n", strerror(-err));
+		char errorMsg[256];
+    Err("error rt_dev_ioctl RTSER_RTIOC_SET_CONFIG (%s)\n", strerror_r(-err, errorMsg, sizeof(errorMsg)));
   }
 }
Index: trunk/lib/FlairCore/src/Semaphore_impl.cpp
===================================================================
--- trunk/lib/FlairCore/src/Semaphore_impl.cpp	(revision 132)
+++ trunk/lib/FlairCore/src/Semaphore_impl.cpp	(revision 133)
@@ -28,4 +28,6 @@
   this->self = self;
   int status;
+	char errorMsg[256];
+	
 #ifdef __XENO__
   status = rt_sem_create(&semaphore, NULL, initialValue, S_FIFO);
@@ -34,5 +36,5 @@
 #endif
   if (status != 0) {
-    self->Err("error creating semaphore (%s)\n", strerror(-status));
+    self->Err("error creating semaphore (%s)\n", strerror_r(-status, errorMsg, sizeof(errorMsg)));
   }
 }
@@ -40,4 +42,6 @@
 Semaphore_impl::~Semaphore_impl() {
   int status;
+	char errorMsg[256];
+	
 #ifdef __XENO__
   status = rt_sem_delete(&semaphore);
@@ -46,5 +50,5 @@
 #endif
   if (status != 0)
-    self->Err("error destroying semaphore (%s)\n", strerror(-status));
+    self->Err("error destroying semaphore (%s)\n", strerror_r(-status, errorMsg, sizeof(errorMsg)));
 }
 
@@ -73,5 +77,6 @@
   		  	self->Warn("warning : semaphore timedout\n");	
   		} else {
-  		    self->Err("error getting the semaphore (%s)\n", strerror(-status));
+					char errorMsg[256];
+  		    self->Err("error getting the semaphore (%s)\n", strerror_r(-status, errorMsg, sizeof(errorMsg)));
   		}
     returnValue = false;
@@ -89,5 +94,6 @@
 #endif
   if (status != 0) {
-    self->Err("error releasing the semaphore (%s)\n", strerror(-status));
+		char errorMsg[256];
+    self->Err("error releasing the semaphore (%s)\n", strerror_r(-status, errorMsg, sizeof(errorMsg)));
     returnValue = false;
   }
Index: trunk/lib/FlairCore/src/SharedMem_impl.cpp
===================================================================
--- trunk/lib/FlairCore/src/SharedMem_impl.cpp	(revision 132)
+++ trunk/lib/FlairCore/src/SharedMem_impl.cpp	(revision 133)
@@ -30,4 +30,5 @@
   this->size = size;
   this->self = self;
+	char errorMsg[256];
 
 #ifdef __XENO__
@@ -40,5 +41,5 @@
   }
   if (status != 0) {
-    self->Err("rt_heap_create error (%s)\n", strerror(-status));
+    self->Err("rt_heap_create error (%s)\n", strerror_r(-status, errorMsg, sizeof(errorMsg)));
     return;
   }
@@ -47,5 +48,5 @@
   status = rt_heap_alloc(&heap, 0, TM_NONBLOCK, &ptr);
   if (status != 0) {
-    self->Err("rt_heap_alloc error (%s)\n", strerror(-status));
+    self->Err("rt_heap_alloc error (%s)\n", strerror_r(-status, errorMsg, sizeof(errorMsg)));
   }
   mem_segment = (char *)ptr;
@@ -59,5 +60,5 @@
   }
   if (status != 0) {
-    self->Err("rt_mutex_create error (%s)\n", strerror(-status));
+    self->Err("rt_mutex_create error (%s)\n", strerror_r(-status, errorMsg, sizeof(errorMsg)));
     return;
   }
@@ -87,4 +88,6 @@
 SharedMem_impl::~SharedMem_impl() {
   int status;
+	char errorMsg[256];
+	
 #ifdef __XENO__
   /* unnecessary because heap is opened in H_SINGLE mode
@@ -92,5 +95,5 @@
   if(status!=0)
   {
-      self->Err("rt_heap_free error (%s)\n",strerror(-status));
+      self->Err("rt_heap_free error (%s)\n",strerror_r(-status, errorMsg, sizeof(errorMsg)));
   }
   */
@@ -99,5 +102,5 @@
     status = rt_heap_delete(&heap);
     if (status != 0) {
-      self->Err("rt_heap_delete error (%s)\n", strerror(-status));
+      self->Err("rt_heap_delete error (%s)\n", strerror_r(-status, errorMsg, sizeof(errorMsg)));
     }
   }
@@ -106,5 +109,5 @@
     status = rt_mutex_delete(&mutex);
     if (status != 0) {
-      self->Err("error destroying mutex (%s)\n", strerror(-status));
+      self->Err("error destroying mutex (%s)\n", strerror_r(-status, errorMsg, sizeof(errorMsg)));
     }
   }
@@ -112,10 +115,10 @@
   status = munmap(mem_segment, size);
   if (status != 0) {
-    self->Err("Failed to unmap memory (%s)\n", strerror(-status));
+    self->Err("Failed to unmap memory (%s)\n", strerror_r(-status, errorMsg, sizeof(errorMsg)));
   }
 
   status = close(fd);
   if (status != 0) {
-    self->Err("Failed to close file (%s)\n", strerror(-status));
+    self->Err("Failed to close file (%s)\n", strerror_r(-status, errorMsg, sizeof(errorMsg)));
   }
 
@@ -124,5 +127,5 @@
    if(status!=0)
    {
-       self->Err("Failed to unlink memory (%s)\n",strerror(-status));
+       self->Err("Failed to unlink memory (%s)\n",strerror_r(-status, errorMsg, sizeof(errorMsg)));
    }
 */
@@ -131,10 +134,10 @@
    if(status!=0)
    {
-       self->Err("Failed to unlink semaphore (%s)\n",strerror(-status));
+       self->Err("Failed to unlink semaphore (%s)\n",strerror_r(-status, errorMsg, sizeof(errorMsg)));
    }*/
 
   status = sem_close(sem);
   if (status != 0) {
-    self->Err("Failed to close semaphore (%s)\n", strerror(-status));
+    self->Err("Failed to close semaphore (%s)\n", strerror_r(-status, errorMsg, sizeof(errorMsg)));
   }
 #endif
@@ -144,10 +147,14 @@
 #ifdef __XENO__
   int status = rt_mutex_acquire(&mutex, TM_INFINITE);
-  if (status != 0)
-    self->Err("error (%s)\n", strerror(-status));
+  if (status != 0) {
+		char errorMsg[256];
+    self->Err("error (%s)\n", strerror_r(-status, errorMsg, sizeof(errorMsg)));
+	}
   memcpy(mem_segment, buf, size);
   status = rt_mutex_release(&mutex);
-  if (status != 0)
-    self->Err("error (%s)\n", strerror(-status));
+  if (status != 0) {
+		char errorMsg[256];
+    self->Err("error (%s)\n", strerror_r(-status, errorMsg, sizeof(errorMsg)));
+	}
 #else
   sem_wait(sem);
@@ -160,10 +167,14 @@
 #ifdef __XENO__
   int status = rt_mutex_acquire(&mutex, TM_INFINITE);
-  if (status != 0)
-    self->Err("error (%s)\n", strerror(-status));
+  if (status != 0) {
+		char errorMsg[256];
+    self->Err("error (%s)\n", strerror_r(-status, errorMsg, sizeof(errorMsg)));
+	}
   memcpy(buf, mem_segment, size);
   status = rt_mutex_release(&mutex);
-  if (status != 0)
-    self->Err("error (%s)\n", strerror(-status));
+  if (status != 0) {
+		char errorMsg[256];
+    self->Err("error (%s)\n", strerror_r(-status, errorMsg, sizeof(errorMsg)));
+	}
 #else
   sem_wait(sem);
Index: trunk/lib/FlairCore/src/Socket_impl.cpp
===================================================================
--- trunk/lib/FlairCore/src/Socket_impl.cpp	(revision 132)
+++ trunk/lib/FlairCore/src/Socket_impl.cpp	(revision 133)
@@ -103,5 +103,6 @@
 #endif
   if (status != 0) {
-    self->Err("rt_pipe_create error (%s)\n", strerror(-status));
+		char errorMsg[256];
+    self->Err("rt_pipe_create error (%s)\n", strerror_r(-status, errorMsg, sizeof(errorMsg)));
   }
 
@@ -148,7 +149,8 @@
   pthread_join(user_thread, NULL);
   int status = rt_pipe_delete(&pipe);
-  if (status != 0)
-    self->Err("rt_pipe_delete error (%s)\n", strerror(-status));
-
+  if (status != 0) {
+		char errorMsg[256];
+    self->Err("rt_pipe_delete error (%s)\n", strerror_r(-status, errorMsg, sizeof(errorMsg)));
+	}
 #endif
   close(fd);
@@ -158,4 +160,5 @@
   ssize_t written;
   string to_send;
+	char errorMsg[256];
 
   if (broadcast == true) {
@@ -170,5 +173,5 @@
 
   if (written < 0) {
-    self->Err("rt_pipe_write error (%s)\n", strerror(-written));
+    self->Err("rt_pipe_write error (%s)\n", strerror_r(-written, errorMsg, sizeof(errorMsg)));
   } else if (written != (ssize_t)src_len) {
     self->Err("rt_pipe_write error %i/%i\n", written, to_send.size());
@@ -178,5 +181,6 @@
       sendto(fd, src, src_len, 0, (struct sockaddr *)&sock_in, sizeof(sock_in));
   if(written==-1) {
-    self->Err("sendto error (%s)\n",strerror(-errno));
+		char errorMsg[256];
+    self->Err("sendto error (%s)\n",strerror_r(errno, errorMsg, sizeof(errorMsg)));
   } else if (written != (ssize_t)src_len) {
     self->Err("sendto error %i/%i\n",written,src_len);
@@ -195,5 +199,6 @@
 
   if (written < 0) {
-    self->Err("rt_pipe_write error (%s)\n", strerror(-written));
+		char errorMsg[256];
+    self->Err("rt_pipe_write error (%s)\n", strerror_r(-written, errorMsg, sizeof(errorMsg)));
   } else if (written != (ssize_t)message.size()) {
     self->Err("rt_pipe_write error %i/%i\n", written, message.size());
@@ -295,6 +300,8 @@
   while (pipe_fd < 0) {
     pipe_fd = open(devname.c_str(), O_RDWR);
-    if (pipe_fd < 0 && errno != ENOENT)
-      caller->self->Err("open pipe_fd error (%s)\n", strerror(-errno));
+    if (pipe_fd < 0 && errno != ENOENT) {
+			char errorMsg[256];
+			caller->self->Err("open pipe_fd error (%s)\n", strerror_r(errno, errorMsg, sizeof(errorMsg)));
+		}
     usleep(1000);
   }
Index: trunk/lib/FlairCore/src/Thread.cpp
===================================================================
--- trunk/lib/FlairCore/src/Thread.cpp	(revision 132)
+++ trunk/lib/FlairCore/src/Thread.cpp	(revision 133)
@@ -87,8 +87,9 @@
 #ifdef __XENO__
   int status = rt_task_sleep_until(time);
-  if (status != 0)
+  if (status != 0) {
+		char errorMsg[256];
     Err("%s, error rt_task_sleep_until (%s), resume time: %lld, actual time: "
-        "%lld\n",
-        ObjectName().c_str(), strerror(-status), time, GetTime());
+        "%lld\n", ObjectName().c_str(), strerror_r(-status, errorMsg, sizeof(errorMsg)), time, GetTime());
+	}
 // Printf("rt_task_sleep_until, resume time: %lld, actual time:
 // %lld\n",time,GetTime());
@@ -104,6 +105,8 @@
 #ifdef __XENO__
   int status = rt_task_sleep(time * 1000 * 1000);
-  if (status != 0)
-    Err("erreur rt_task_sleep (%s)\n", strerror(-status));
+  if (status != 0) {
+		char errorMsg[256];
+    Err("erreur rt_task_sleep (%s)\n", strerror_r(-status, errorMsg, sizeof(errorMsg)));
+	}
 #else
   usleep(time * 1000);
@@ -114,6 +117,8 @@
 #ifdef __XENO__
   int status = rt_task_sleep(time * 1000);
-  if (status != 0)
-    Err("erreur rt_task_sleep (%s)\n", strerror(-status));
+  if (status != 0) {
+		char errorMsg[256];
+    Err("erreur rt_task_sleep (%s)\n", strerror_r(-status, errorMsg, sizeof(errorMsg)));
+	}
 #else
   usleep(time);
Index: trunk/lib/FlairCore/src/Thread_impl.cpp
===================================================================
--- trunk/lib/FlairCore/src/Thread_impl.cpp	(revision 132)
+++ trunk/lib/FlairCore/src/Thread_impl.cpp	(revision 133)
@@ -78,4 +78,5 @@
 void Thread_impl::Start(void) {
   int status;
+	char errorMsg[256];
 
   isRunning = true;
@@ -94,5 +95,5 @@
 #endif // RT_STACK_SIZE
   if (status != 0) {
-    self->Err("rt_task_create error (%s)\n", strerror(-status));
+    self->Err("rt_task_create error (%s)\n", strerror_r(-status, errorMsg, sizeof(errorMsg)));
   } else {
     //_printf("rt_task_create ok %s\n",th_name);
@@ -101,5 +102,5 @@
   status = rt_task_start(&task_rt, &main_rt, (void *)this);
   if (status != 0) {
-    self->Err("rt_task_start error (%s)\n", strerror(-status));
+    self->Err("rt_task_start error (%s)\n", strerror_r(-status, errorMsg, sizeof(errorMsg)));
   } else {
     //_printf("rt_task_start ok %s\n",th_name);
@@ -178,6 +179,8 @@
 #ifdef __XENO__
   int status = rt_task_set_periodic(&task_rt, TM_NOW, period * 1000);
-  if (status != 0)
-    self->Err("Error rt_task_set_periodic %s\n", strerror(-status));
+  if (status != 0) {
+		char errorMsg[256];
+    self->Err("Error rt_task_set_periodic %s\n", strerror_r(-status, errorMsg, sizeof(errorMsg)));
+	}
 #else
   next_time -= period;
@@ -198,6 +201,8 @@
 #ifdef __XENO__
   int status = rt_task_set_periodic(&task_rt, TM_NOW, period * 1000 * 1000);
-  if (status != 0)
-    self->Err("Error rt_task_set_periodic %s\n", strerror(-status));
+  if (status != 0) {
+		char errorMsg[256];
+    self->Err("Error rt_task_set_periodic %s\n", strerror_r(-status, errorMsg, sizeof(errorMsg)));
+	}
 #else
   next_time -= period;
@@ -218,8 +223,11 @@
   unsigned long overruns_r;
   int status = rt_task_wait_period(&overruns_r);
-  if (status != 0)
-    self->Err("Error rt_task_wait_period %s\n", strerror(-status));
-  if (status == -ETIMEDOUT)
+  if (status != 0) {
+		char errorMsg[256];
+    self->Err("Error rt_task_wait_period %s\n", strerror_r(-status, errorMsg, sizeof(errorMsg)));
+	}
+  if (status == -ETIMEDOUT) {
     self->Err("overrun: %lld\n", overruns_r);
+	}
 #else
   self->SleepUntil(next_time);
@@ -310,5 +318,6 @@
   int status = rt_task_inquire(NULL, &info);
   if (status != 0) {
-    self->Err("Error rt_task_inquire %s\n", strerror(-status));
+		char errorMsg[256];
+    self->Err("Error rt_task_inquire %s\n", strerror_r(-status, errorMsg, sizeof(errorMsg)));
   } else
 #endif
@@ -348,4 +357,5 @@
   if (isRunning == true) {
     int status;
+		char errorMsg[256];
 
 #ifdef __XENO__
@@ -355,5 +365,5 @@
 #endif
     if (status != 0)
-      self->Err("error %s\n", strerror(-status));
+      self->Err("error %s\n", strerror_r(-status, errorMsg, sizeof(errorMsg)));
     isRunning = false;
   }
Index: trunk/lib/FlairCore/src/Unix_I2cPort.cpp
===================================================================
--- trunk/lib/FlairCore/src/Unix_I2cPort.cpp	(revision 132)
+++ trunk/lib/FlairCore/src/Unix_I2cPort.cpp	(revision 133)
@@ -17,5 +17,4 @@
 
 #include "Unix_I2cPort.h"
-#include <errno.h>
 #include <fcntl.h> /* File control definitions */
 #include <unistd.h>
Index: trunk/lib/FlairCore/src/Widget_impl.cpp
===================================================================
--- trunk/lib/FlairCore/src/Widget_impl.cpp	(revision 132)
+++ trunk/lib/FlairCore/src/Widget_impl.cpp	(revision 133)
@@ -24,7 +24,4 @@
 #ifdef __XENO__
 #include <native/heap.h>
-#else
-#include <errno.h>
-#include <cstring>
 #endif
 
@@ -45,5 +42,6 @@
 
   if (status != 0) {
-    printf("libxml2: rt_heap_free error (%s)\n", strerror(-status));
+		char errorMsg[256];
+    printf("libxml2: rt_heap_free error (%s)\n", strerror_r(-status, errorMsg, sizeof(errorMsg)));
   }
 }
@@ -54,5 +52,6 @@
   int status = rt_heap_alloc(&xml_heap, sz, TM_NONBLOCK, &ptr);
   if (status != 0) {
-    printf("libxml2: rt_heap_alloc error (%s)\n", strerror(-status));
+		char errorMsg[256];
+    printf("libxml2: rt_heap_alloc error (%s)\n", strerror_r(-status, errorMsg, sizeof(errorMsg)));
   }
   // Printf("alloc %x %i\n",ptr,sz);
@@ -106,5 +105,6 @@
     int status = rt_heap_create(&xml_heap, tmp_name.c_str(), XML_HEAP, H_FIFO);
     if (status != 0) {
-      self->Err("rt_heap_create error (%s)\n", strerror(-status));
+			char errorMsg[256];
+      self->Err("rt_heap_create error (%s)\n", strerror_r(-status, errorMsg, sizeof(errorMsg)));
     }
 
@@ -188,8 +188,9 @@
 #ifdef __XENO__
     int status;
+		char errorMsg[256];
     RT_HEAP_INFO info;
     status = rt_heap_inquire(&xml_heap, &info);
     if (status != 0) {
-      self->Err("rt_heap_inquire error (%s)\n", strerror(-status));
+      self->Err("rt_heap_inquire error (%s)\n", strerror_r(-status, errorMsg, sizeof(errorMsg)));
     }
     if (info.usedmem != 0)
@@ -198,5 +199,5 @@
     status = rt_heap_delete(&xml_heap);
     if (status != 0) {
-      self->Err("rt_heap_delete error (%s)\n", strerror(-status));
+      self->Err("rt_heap_delete error (%s)\n", strerror_r(-status, errorMsg, sizeof(errorMsg)));
     }
 #endif
Index: trunk/lib/FlairCore/src/ui_com.cpp
===================================================================
--- trunk/lib/FlairCore/src/ui_com.cpp	(revision 132)
+++ trunk/lib/FlairCore/src/ui_com.cpp	(revision 133)
@@ -70,5 +70,6 @@
 
   if (status != 0) {
-    Err("rt_pipe_create error (%s)\n", strerror(-status));
+		char errorMsg[256];
+    Err("rt_pipe_create error (%s)\n", strerror_r(-status, errorMsg, sizeof(errorMsg)));
     // return -1;
   }
@@ -125,6 +126,8 @@
 
   int status = rt_pipe_delete(&pipe);
-  if (status != 0)
-    Err("rt_pipe_delete error (%s)\n", strerror(-status));
+  if (status != 0) {
+		char errorMsg[256];
+    Err("rt_pipe_delete error (%s)\n", strerror_r(-status, errorMsg, sizeof(errorMsg)));
+	}
 #endif
 
@@ -160,5 +163,6 @@
 
   if (nb_write < 0) {
-    Err("rt_pipe_write error (%s)\n", strerror(-nb_write));
+		char errorMsg[256];
+    Err("rt_pipe_write error (%s)\n", strerror_r(-nb_write, errorMsg, sizeof(errorMsg)));
   } else if (nb_write != size) {
     Err("rt_pipe_write error %i/%i\n", nb_write, size);
@@ -326,6 +330,8 @@
   while (pipe_fd < 0) {
     pipe_fd = open(devname.c_str(), O_RDWR);
-    if (pipe_fd < 0 && errno != ENOENT)
-      caller->Err("open pipe_fd error (%s)\n", strerror(-errno));
+    if (pipe_fd < 0 && errno != ENOENT) {
+			char errorMsg[256];
+      caller->Err("open pipe_fd error (%s)\n", strerror_r(errno, errorMsg, sizeof(errorMsg)));
+		}
     usleep(1000);
   }
