Skip to content
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

In the embedded Linux environment, the application runs automatically… #27

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 16 additions & 3 deletions src/rtpsession.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1565,6 +1565,7 @@ int RTPSession::CreateCNAME(uint8_t *buffer,size_t *bufferlength,bool resolve)
{
#ifndef WIN32
bool gotlogin = true;
char defUser[]="root";
#ifdef RTP_SUPPORT_GETLOGINR
buffer[0] = 0;
if (getlogin_r((char *)buffer,*bufferlength) != 0)
Expand Down Expand Up @@ -1592,9 +1593,21 @@ int RTPSession::CreateCNAME(uint8_t *buffer,size_t *bufferlength,bool resolve)
#endif // RTP_SUPPORT_GETLOGINR
if (!gotlogin)
{
char *logname = getenv("LOGNAME");
if (logname == 0)
return ERR_RTP_SESSION_CANTGETLOGINNAME;
char *logname=NULL;
for(int i = 0 ; environ[i] ;i++)
{
logname=strstr(environ[i], "LOGNAME");
if(logname)
break;
}
if(logname){
logname = getenv("LOGNAME");
if (logname == 0)
return ERR_RTP_SESSION_CANTGETLOGINNAME;
}
else
logname=defUser;

strncpy((char *)buffer,logname,*bufferlength);
}
#else // Win32 version
Expand Down