-
Notifications
You must be signed in to change notification settings - Fork 60
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
issue #204: fix get pthread id problem. #205
base: master
Are you sure you want to change the base?
Conversation
This PR also can fix after merged to release branches. |
9f17f00
to
3f4ccab
Compare
3f4ccab
to
fdb10b4
Compare
fdb10b4
to
e4a7d8b
Compare
uint64_t tid; | ||
int r = pthread_threadid_np(NULL, &tid); | ||
if (!r) { | ||
return tid; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will overflow as returning uint64_t
while function returns ks_pid_t
that is pid_t
aka int
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
try fix it on commit : d2cae9c
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please note there are places in the code under questions now:
uint32_t id = (uint32_t)ks_thread_self_id();
Line 203 in 5b9dcfb
used += snprintf(buf + used - 1, bufSize - used, "#%8.8X ", id); |
Line 291 in 5b9dcfb
uint32_t id = (uint32_t)ks_thread_self_id(); |
or
static inline unsigned long ks_ssl_thread_id(void)
{
return ks_thread_self_id();
}
CRYPTO_set_id_callback(ks_ssl_thread_id);
fix #204