From cf9e598dd036701ce82cd70552015893e6f0e25e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Revol?= Date: Fri, 11 Jan 2008 13:05:06 +0000 Subject: [PATCH] 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 --- src/system/libroot/posix/pwd.c | 25 +++++++++++++++++++++ src/system/libroot/posix/pwd_query.c | 24 ++++++++++++++++++++ src/system/libroot/posix/unistd/usergroup.c | 25 --------------------- 3 files changed, 49 insertions(+), 25 deletions(-) diff --git a/src/system/libroot/posix/pwd.c b/src/system/libroot/posix/pwd.c index 019fa91c46..404831463f 100644 --- a/src/system/libroot/posix/pwd.c +++ b/src/system/libroot/posix/pwd.c @@ -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; +} + diff --git a/src/system/libroot/posix/pwd_query.c b/src/system/libroot/posix/pwd_query.c index 65e6f7a695..521df6aa03 100644 --- a/src/system/libroot/posix/pwd_query.c +++ b/src/system/libroot/posix/pwd_query.c @@ -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) { diff --git a/src/system/libroot/posix/unistd/usergroup.c b/src/system/libroot/posix/unistd/usergroup.c index fd7628b8f1..693ceeb393 100644 --- a/src/system/libroot/posix/unistd/usergroup.c +++ b/src/system/libroot/posix/unistd/usergroup.c @@ -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; -} - -