X-Git-Url: https://git.lttng.org/?p=lttng-tools.git;a=blobdiff_plain;f=src%2Fcommon%2Ferror.c;h=11dbc90289806decc6507f11f94727ab9e0476a1;hp=82190b9fd527cea831f61e9620b43f73d1984c17;hb=cb8d0d245b5739e7493dcf27314f6e42615f14b1;hpb=97285430b75f44b6ce590e86cb9d996390e514c8 diff --git a/src/common/error.c b/src/common/error.c index 82190b9fd..11dbc9028 100644 --- a/src/common/error.c +++ b/src/common/error.c @@ -14,6 +14,7 @@ #include #include +#include #include #include @@ -77,16 +78,9 @@ void logger_set_thread_name(const char *name, bool set_pthread_name) URCU_TLS(logger_thread_name) = name; if (set_pthread_name) { - char pthread_name[16]; - - /* - * Truncations are expected since pthread limits thread names to - * a generous 16 characters. - */ - strncpy(pthread_name, name, sizeof(pthread_name)); - pthread_name[sizeof(pthread_name) - 1] = '\0'; - ret = pthread_setname_np(pthread_self(), pthread_name); - if (ret) { + ret = lttng_thread_setname(name); + if (ret && ret != -ENOSYS) { + /* Don't fail as this is not essential. */ DBG("Failed to set pthread name attribute"); } }