Skip to content

Commit

Permalink
Use main_thread for set_cwd/get_cwd
Browse files Browse the repository at this point in the history
  • Loading branch information
Luca Marturana authored and luca3m committed Nov 10, 2016
1 parent a386d38 commit 411ac7c
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions userspace/libsinsp/threadinfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -630,7 +630,12 @@ sinsp_threadinfo* sinsp_threadinfo::get_cwd_root()

string sinsp_threadinfo::get_cwd()
{
sinsp_threadinfo* tinfo = get_cwd_root();
// Ideally we should use get_cwd_root()
// but scap does not read CLONE_FS from /proc
// Also glibc and muslc use always
// CLONE_THREAD|CLONE_FS so let's use
// get_main_thread() for now
sinsp_threadinfo* tinfo = get_main_thread();

if(tinfo)
{
Expand All @@ -646,7 +651,7 @@ string sinsp_threadinfo::get_cwd()
void sinsp_threadinfo::set_cwd(const char* cwd, uint32_t cwdlen)
{
char tpath[SCAP_MAX_PATH_SIZE];
sinsp_threadinfo* tinfo = get_cwd_root();
sinsp_threadinfo* tinfo = get_main_thread();

if(tinfo)
{
Expand Down

0 comments on commit 411ac7c

Please sign in to comment.