diff options
author | Ilya Mashchenko <ilya@netdata.cloud> | 2023-09-20 00:15:12 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-09-20 00:15:12 +0300 |
commit | f54a99f01dedc0d598fbc5fffd5b3e2372c24643 (patch) | |
tree | c6e17745bbd5dc0537c812b0855acbb917b80ca0 /libnetdata | |
parent | 541facfa3e5021ebc5c7fb8944987f3a3a02d48a (diff) |
fix crash on setting thread name (#16016)
Diffstat (limited to 'libnetdata')
-rw-r--r-- | libnetdata/threads/threads.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/libnetdata/threads/threads.c b/libnetdata/threads/threads.c index a26eba7341..09e08cd188 100644 --- a/libnetdata/threads/threads.c +++ b/libnetdata/threads/threads.c @@ -234,12 +234,12 @@ void uv_thread_set_name_np(uv_thread_t ut, const char* name) { strncpyz(threadname, name, NETDATA_THREAD_NAME_MAX); #if defined(__FreeBSD__) - pthread_set_name_np(ut, threadname); + pthread_set_name_np(ut ? ut : pthread_self(), threadname); #elif defined(__APPLE__) // Apple can only set its own name UNUSED(ut); #else - ret = pthread_setname_np(ut, threadname); + ret = pthread_setname_np(ut ? ut : pthread_self(), threadname); #endif thread_name_get(true); |