vcpkg/ports/pthreads/fix-pthread_getname_np.patch
tdcosta100 b7eaf99a7b
[pthreads] Fix EACCESSVIOLATION in pthread_getname_np and better install handling (#28173)
* [pthreads] Fix EACCESSVIOLATION in pthread_getname_np

* [pthreads] Use vcpkg options instead custom commands

* [pthreads] Update port version

* [pthreads] Don't use separate builds for release and debug

* [pthreads] Update port version

* [pthreads] Cleaner solution for building configuration

* [pthreads] Update port version

* [pthreads] Correct variable name

* [pthreads] Update port version

* [pthreads] Make install even more optimized

* [pthreads] Update port version

* [pthreads] Fix static builds

* [pthreads] Update port version

* [pthreads] Correct quotes

* [pthreads] Update port version

* [pthreads] Fix compatibility with UWP

* [pthreads] Update port version

* [pthreads] Correction in fix-pthread_getname_np.patch

* [pthreads] Update port version
2022-12-28 14:04:12 -08:00

27 lines
618 B
Diff

diff --git a/pthread_getname_np.c b/pthread_getname_np.c
index 8fc32b1..7c18655 100644
--- a/pthread_getname_np.c
+++ b/pthread_getname_np.c
@@ -59,10 +59,18 @@ pthread_getname_np(pthread_t thr, char *name, int len)
__ptw32_mcs_lock_acquire (&tp->threadLock, &threadLock);
- for (s = tp->name, d = name; *s && d < &name[len - 1]; *d++ = *s++)
- {}
+ if(tp->name)
+ {
+ for (s = tp->name, d = name; *s && d < &name[len - 1]; *d++ = *s++)
+ {}
+
+ *d = '\0';
+ }
+ else
+ {
+ *name = '\0';
+ }
- *d = '\0';
__ptw32_mcs_lock_release (&threadLock);
return result;