raster pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=350698bada808ef6456b9118efe7b6fc1b4c7bf4

commit 350698bada808ef6456b9118efe7b6fc1b4c7bf4
Author: Carsten Haitzler (Rasterman) <ras...@rasterman.com>
Date:   Thu Sep 10 15:15:01 2015 +0900

    eina - thread naming - when naming thread, cut off at 15 chars
    
    automatically cut off at 15 chars (and add 0 byte) to ensure we get a
    name, but just truncate it if it is too long.
---
 src/lib/eina/eina_thread.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/src/lib/eina/eina_thread.c b/src/lib/eina/eina_thread.c
index 2730662..3d64f5a 100644
--- a/src/lib/eina/eina_thread.c
+++ b/src/lib/eina/eina_thread.c
@@ -174,7 +174,14 @@ EAPI Eina_Bool
 eina_thread_name_set(Eina_Thread t, const char *name)
 {
 #ifdef EINA_HAVE_PTHREAD_SETNAME
-   if (pthread_setname_np((pthread_t)t, name) == 0) return EINA_TRUE;
+   char buf[16];
+   if (name)
+     {
+        strncpy(buf, name, 15);
+        buf[15] = 0;
+     }
+   else buf[0] = 0;
+   if (pthread_setname_np((pthread_t)t, buf) == 0) return EINA_TRUE;
 #endif
    return EINA_FALSE;
 }

-- 


Reply via email to