Community
Participate
Working Groups
Build Identifier: The Linux TCF agent get_user_name() implementation (in agent/tcf/framework/mdep.c) is not reliable since it relies on getlogin() which requires a controlling terminal for the process. If you start the TCF agent from Eclipse to debug it (for example) then getlogin() will return NULL. It seems it would be better to use getpwuid(getuid()) to retrieve user name (this code is already used in get_user_home(). Reproducible: Always Steps to Reproduce: 1.Launch TCF agent from a Eclipse CDT Debug Session 2.Look at the TCF agent peers properties 3.You will see that UserName is not correctly set
Created attachment 213623 [details] Proposed Patch for get_user_name(). This is a suggested patch for get_user_name() implementation based on getpwuid().
I have re-arranged the code a little bit: since it now saves result of getlogin() in a static variable, it needs to be strdup()-ed too. Committed. Thanks!