Skip to content

Commit 411ac7c

Browse files
Luca Marturanaluca3m
authored andcommitted
Use main_thread for set_cwd/get_cwd
1 parent a386d38 commit 411ac7c

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

userspace/libsinsp/threadinfo.cpp

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -630,7 +630,12 @@ sinsp_threadinfo* sinsp_threadinfo::get_cwd_root()
630630

631631
string sinsp_threadinfo::get_cwd()
632632
{
633-
sinsp_threadinfo* tinfo = get_cwd_root();
633+
// Ideally we should use get_cwd_root()
634+
// but scap does not read CLONE_FS from /proc
635+
// Also glibc and muslc use always
636+
// CLONE_THREAD|CLONE_FS so let's use
637+
// get_main_thread() for now
638+
sinsp_threadinfo* tinfo = get_main_thread();
634639

635640
if(tinfo)
636641
{
@@ -646,7 +651,7 @@ string sinsp_threadinfo::get_cwd()
646651
void sinsp_threadinfo::set_cwd(const char* cwd, uint32_t cwdlen)
647652
{
648653
char tpath[SCAP_MAX_PATH_SIZE];
649-
sinsp_threadinfo* tinfo = get_cwd_root();
654+
sinsp_threadinfo* tinfo = get_main_thread();
650655

651656
if(tinfo)
652657
{

0 commit comments

Comments
 (0)