Fix the build for you mortal monousers.

Actually getlogin didn't belong to usergroup.c in the first place anyway.
And definitely not to the kernel.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23391 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
François Revol 2008-01-11 13:05:06 +00:00
parent 586cf6aeba
commit cf9e598dd0
3 changed files with 49 additions and 25 deletions

View File

@ -132,3 +132,28 @@ getpwuid_r(uid_t uid, struct passwd *passwd, char *buffer,
*_result = passwd;
return 0;
}
char *getlogin()
{
struct passwd *pw;
pw = getpwuid(getuid());
if (pw)
return pw->pw_name;
errno = ENOMEM;
return NULL;
}
int getlogin_r(char *name, size_t nameSize)
{
struct passwd *pw;
pw = getpwuid(getuid());
if (pw && (nameSize > 32/*PW_MAX_NAME*/)) {
memset(name, 0, nameSize);
strlcpy(name, pw->pw_name, 32/*PW_MAX_NAME*/);
return B_OK;
}
return ENOMEM;
}

View File

@ -621,6 +621,30 @@ struct passwd *getpwnam(const char *name)
}
char *getlogin()
{
struct passwd *pw;
pw = getpwuid(getuid());
if (pw)
return pw->pw_name;
errno = ENOMEM;
return NULL;
}
int getlogin_r(char *name, size_t nameSize)
{
struct passwd *pw;
pw = getpwuid(getuid());
if (pw && (nameSize > 32/*PW_MAX_NAME*/)) {
memset(name, 0, nameSize);
strlcpy(name, pw->pw_name, 32/*PW_MAX_NAME*/);
return B_OK;
}
return ENOMEM;
}
void __init_pwd_stuff(void)
//void _multiuser_init(void)
{

View File

@ -100,28 +100,3 @@ seteuid(uid_t uid)
return EPERM;
}
char *getlogin()
{
struct passwd *pw;
pw = getpwuid(getuid());
if (pw)
return pw->pw_name;
errno = ENOMEM;
return NULL;
}
int getlogin_r(char *name, size_t nameSize)
{
struct passwd *pw;
pw = getpwuid(getuid());
if (pw && (nameSize > 32/*PW_MAX_NAME*/)) {
memset(name, 0, nameSize);
strlcpy(name, pw->pw_name, 32/*PW_MAX_NAME*/);
return B_OK;
}
return ENOMEM;
}