Skip to content

Abbreviation in setThreadName can happen even if thread name is not too long #1022

@kimgr

Description

@kimgr

https://github.com/pocoproject/poco/blob/develop/Foundation/src/Thread_POSIX.cpp#L79

pthread_setname_np is documented to return ERANGE if the name is too long, so we should only go into abbreviation mode if it actually returns ERANGE. There are other error returns documented for pthread_setname_np, and the current code will blow the stack if the thread name is actually shorter.

Also, on line 83 you use std::memcpy and then on line 85 you use naked memcpy. Might be nice to be consistent here.

It would be great if we could get these fixes into Poco 1.6.2, then we can retire our local patch for the next internal roll.

Thanks!

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions