diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/util.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/util.c b/lib/util.c index 96a71550d..3fb3a4b40 100644 --- a/lib/util.c +++ b/lib/util.c @@ -645,6 +645,12 @@ set_subprogram_name(const char *subprogram_name) free(subprogram_name_set(pname)); #if HAVE_GLIBC_PTHREAD_SETNAME_NP + /* The maximum supported thread name including '\0' is 16. + * Add '>' at 0th position to highlight that the name was truncated. */ + if (strlen(pname) > 15) { + memmove(pname, &pname[strlen(pname) - 15], 15 + 1); + pname[0] = '>'; + } pthread_setname_np(pthread_self(), pname); #elif HAVE_NETBSD_PTHREAD_SETNAME_NP pthread_setname_np(pthread_self(), "%s", pname); |